'******************************************
'拖拽文件,获取文件路径
'******************************************
If wscript.Arguments.count=0 then
msgbox "拖拽文件到本图标",0,"提示"
End if
for a=0 to wscript.Arguments.count-1
strPath=wscript.Arguments(a)
next
'******************************************
'定义Excle对象、工作薄对象、工作表对象
'******************************************
dim oExcel,oWb,oSheet
set ws=WScript.createobject("wscript.shell")
Set oExcel=CreateObject("Excel.Application")
'打开指定的工作簿
Set oWb=oExcel.Workbooks.Open(strPath)
'显示打开的Excel工作簿
oExcel.visible=true
'******************************************
'遍历工作簿的所有工作表
'******************************************
for j= 1 to oWb.sheets.count
set oSheet=oWb.Sheets(j)
'选中并激活工作表
oSheet.Activate
oSheet.Range("A1")="成功"
next