スクリプトのかなりの部分を取得しましたが、ここからどこから始めればよいかわかりません。
以下のスクリプトでは、ファイルを開いて列を移動し、日付と時刻を前に付けて新しいフォルダーにファイルを保存します。
私がしたいのは、それらの列を新しいファイルにコピーすることです
このスクリプトの進行方法を変更してもかまいません。完全に変更できます。
Set objArgs = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
For I = 0 to objArgs.Count - 1
CmplName = Year(Now()) & Month(Now()) & Day(Now()) & "H" & Hour(Now()) & "_"
FullName = objArgs(I)
FileName = Left(objArgs(I), InstrRev(objArgs(I), ".") )
RdyPath = "OrReady"
FNPathLen = InstrRev(FullName, "\")
FNLen = Len(FullName)
SNLen = FNLen-FNPathLen
ShortFullName = Right(FullName, SNLen)
ShortFileName = Left(ShortFullName, InstrRev(ShortFullName, ".") )
AdSavPath = Left(FullName, FNPathLen) & RdyPath & "\"
If fso.FolderExists(AdSavPath) Then
Else
fso.CreateFolder(AdSavPath)
End If
Set objExcel = CreateObject("Excel.application")
set objExcelBook = objExcel.Workbooks.Open(FullName)
objExcel.application.visible=false
objExcel.application.displayalerts=false
Set Cols = objExcel.Range("C1","C100000")
Set TCols = objExcel.Range("R1","R100000")
Cols.Cut
TCols.Insert
Set Cols = objExcel.Range("B1","B100000")
Set TCols = objExcel.Range("F1","F100000")
Cols.Cut
TCols.Insert
NewFile = AdSavPath & CmplName & ShortFileName & "xlsx"
objExcel.Workbooks(ShortFullName).SaveAs _
AdSavPath & CmplName & ShortFileName & "xlsx", 51
objExcel.Application.Quit
objExcel.Quit
Set objExcel = Nothing
set objExcelBook = Nothing
If fso.FileExists(NewFile) Then
MsgBox NewFile & " Exist Original File will be deleted => " & FullName
fso.DeleteFile(FullName)
Else
MsgBox " File Was Not Created "& NewFile & " (Did not Exist) Did not Delete Original File"
End If
Next