請問VBS/VBA點樣執行EXE同時又開對應檔案(檔名含variable)?
本帖最後由 bongbong3481 於 2016-3-11 22:07 編輯
以下寫法可以打開個檔案(可用CREATE OBJCT,只是舉例,因為個軟件系公司,屋企裝唔到)
wshshell.run """C:\Program Files\Microsoft Office\Office12\EXCEL.exe""" & """C:\Documents and Settings\BB\桌面\test_20160310.xlsx"""
但如果將個檔案名變成含有variable 就唔得, 有冇人知點解錯左(以下3種方法都唔得 )?
dt="""20160310"""
str="""C:\Documents and Settings\BB\桌面\test_""" & dt & """.xlsx"""
wshshell.run """C:\Program Files\Microsoft Office\Office12\EXCEL.exe""" & str
dt="20160310"
str="C:\Documents and Settings\BB\桌面\test_" & dt & ".xlsx"
wshshell.run """C:\Program Files\Microsoft Office\Office12\EXCEL.exe""" & str
dt=""20160310""
str="""C:\Documents and Settings\BB\桌面\test_""" & dt & """.xlsx"""
wshshell.run """C:\Program Files\Microsoft Office\Office12\EXCEL.exe""" & str |
|
|