GetObject(, “Word.Application”) Office 365

不打扰是莪最后的温柔 提交于 2019-12-13 10:57:27

问题


After installing Office 365 my application code in vba is not working anymore

Set wrd = GetObject(, "Word.Application") 
wrd.Visible = True  
wrd.Documents.Open "C:\My Documents\Temp.doc"  
Set wrd = Nothing

Does someone has any ideas

It does'nt recornize Office 365 with this code above but if i install Office 2016 or 2013 it works.


回答1:


SOLVED !

Search in the registry for correct application name. On windows 7 you can find it in "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\RegisteredApplicati‌​ons". Then replace the new name in "Set wrd = GetObject(, "Word.Application")

Thanks to @pavanc

It was called Word.Application.16 instead of Word.Application




回答2:


I don't know if it's just a markdown error on your part, but your code needs to separate lines:

Set wrd = GetObject(, "Word.Application") 
wrd.Visible = True
wrd.Documents.Open "C:\My Documents\Temp.doc"  
Set wrd = Nothing

If this doesn't help, maybe you can be more precise about the error you're getting?



来源:https://stackoverflow.com/questions/43062382/getobject-word-application-office-365

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!