Dim objExcel
Set objExcel=CreateObject("Excel.Application")
objExcel.Application.visible=False
objExcel.Workbooks.Open("C:\sample.xlsm")
objExcel.Application.Run"sample"
objExcel.DisplayAlerts=False
~処理記述~
objExcel.DisplayAlerts=True
objExcel.Application.visible=True
objExcel.Quit
Set objExcel=Nothing
Dim objFs,b
Set objFs=CreateObject("Scripting.FileSystemObject")
Set b=objFs.OpenTextFile("パス名記述")
Dim myRec
myRec=b.ReadAll
myRec=Replace(myRec,"Taro","Hanako")
b.Close
Set b=objFs.CreateTextFile("パス名記述")
b.WriteLine(myRec)
b.Close
処理前

処理後

Dim x
Set x=WScript.CreateObject("WScript.Network")
WScript.Echo"ユーザー名:"& x.UserName
処理結果

Private Sub WriteUTF8(Byval SourceString As string)
Dim strm As ADODB Stream
Set strm=CreateObject("ADODB.Stream")
With strm
.Type=adTypeText
.Charset="UTF-8"
.Open
Call.WriteText(SourceString,adWriteLine)
Call.SavetoFile("D:\temp\sample.txt,adSaveCreateOverWrite")
.Close
End With
Set strm=Nothing
activeworkbook.activesheet.rows("指定行").Delete
処理前

処理後

With objExcel.ActiveWindow
With objWorkbook.Windows(1)
.SplitRow=1
.FreezePanes=True
End With
処理前

処理後

With objWorksheet
nRow=.Cells(65536,"A").End(-4162).Row
.Range("A:C").Rows(nRow+2).FormulaR1C1="Sum(r2c:r"& nRow &"c)"
End With
処理前

処理後

Set obj=WScript.CreateObject("Excel.Application")
obj.visible=True obj.visible=False
Set book=obj.Workbooks.add()
処理前

処理後

obj.sheets(1).name="最初のシート"

処理後

Set fsht=obj.sheets(1)
fsht.Cells(1,1)="Hellow World"

処理後

book.Save
obj.Quit
Set fsht=Nothing
Set obj=Nothing
objExcel.WindowState=-4137
objExcel.WindowState=-4140
objExcel.WindowState=-4143
Function Is_ExistArray(ArrTarget,CheckValue)
Dim i
Is_ExistArray=False
For i=LBound(ArrTarget)To UBound(ArrTarget)
If ArrTarget(i)=CheckValue Then
Is_ExistArray=True
Exit For
End If
Next
End Function
Set excel=getobject("Excel.Application")
excel.activeworkbook.sheets("特定のシート名").select
'Excelインスタンス作成
Set iobj=WScript.CreateObject("Excel.Application")
iobj=Workbooks.OpenText
WScript.Arguments(0)
Set books=iobj.ActiveWorkbook
'FileSystemObjectインスタンス作成
Set fso=CreateObject("Scripting.FileSystemObject")
cdir=fso.getParentFolderName(WScript.scriptFullName)
books.SaveAs cdir & "\csvtoexcel.xlsx",51
books.Close
iobj.Quit()
Set fso=Nothing
Set iobj=Nothing
Option Explicit
Dim DetPathArray
Set GetPathArray=WScript.Arguments
Dim objFSO
Set objFSO=CreateObject("Scripting.FileSystemObject")
Dim pt,FileName
For Each pt in GetPathArray
FileName=objFSO.GetFileName(pt)
pt=InputBox("ファイル名" & FileName,"フルパス",pt)
Next
Set objFSO=Nothing
Option Explicit
Call Main
Sub Main()
Dim fso
Set fso=CreateObject("Scripting.FileSystemObject")
Dim arg,f,newName
For Each arg In WScript.Arguments
Set f=fso.GetFile(arg)
newName=fso.GetBaseName(f.Name)&"_"& CreateDateTimeString(Now)&"."& fso.GetExtentionName(f.Name)
f.Name=newName
Next
End Sub
Set objDoc="ファイル名"
For Each S In objDoc.styles
If Not S.BuiltIn Then
S.Delete
End If
Next