VBA EXCEL状态下,如何用相对路径和绝对路径调用某XXXX.doc文件,谢谢
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
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
参考资料: http://club.excelhome.net/thread-369406-1-1.html
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询