VBA EXCEL状态下,如何用相对路径和绝对路径调用某XXXX.doc文件,谢谢

2024-12-13 00:00:53
推荐回答(1个)
回答1:

绝对路径(假设在d盘):
Dim wordApp As Object
Set wordApp=CreateObject("Word.Application")
wordApp.Documents.Open "d:\xxxx.doc"

相对路径(假设与此excel在同一路径下):
Dim wordApp As Object
Set wordApp=CreateObject("Word.Application")
wordApp.Documents.Open ActiveWorkbook.Path & "\xxxx.doc"
wdApp.Visible = True