Opening a Word Document from an Excel VBA Module

As part of a complex Excel VBA module I want to open a Word Document (that contains a AutoOpen Macro)... I can open Word using "Application.ActivateMicrosoftApp xlMicrosoftWord", but I can work out how to open a specific document...
[233 byte] By [Gnomie] at [2008-2-11]
# 1
per one of our support engineers:

You need to set an object variable equal to the application, opening the application through createobject rather than activatemicrosoftapp. Set the application to visible if you need to see what’s going on, then you can use the object variable to access Word’s VBA to open the workbook:

Sub automateword()

Set wordapp = CreateObject("word.Application")

wordapp.documents.Open "C:\Documents and Settings\anitao\My Documents\alo2004.doc"

wordapp.Visible = True

End Sub


Article 307216 gives much more detail about using automation with Word

How to use Automation with Word 2002

http://support.microsoft.com/Default.aspx?kbid=307216


I hope this is helpful,
-brenda (ISV Buddy Team)

MSISVBuddyTeam at 2007-9-9 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...
# 2

Brenda,
Thank you very much. A succinct answer, and PRECISELY what I needed.

Your code was directly transferable and worked first time!

Gnomie

Gnomie at 2007-9-9 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...
# 3
I'm glad that it was helpful... I've forwarded your comment to the support engineer. Smile

-brenda (ISV Buddy Team)

MSISVBuddyTeam at 2007-9-9 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...