×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Opening a word document from excel using VBA

Opening a word document from excel using VBA

Opening a word document from excel using VBA

(OP)
Hi,

I'm pretty new to VBA, and I am trying to open a word document from excel VBA.  Can anyone help?

RE: Opening a word document from excel using VBA

some very ancient code, no guarantees about functionality:

CODE

    
    If Tasks.Exists("Microsoft Word") Then Set WordApp = GetObject(, "word.application")
    If WordApp = "" Then Set WordApp = CreateObject("word.application")

    WordApp.Documents.Open FileName:=DwellPath, ReadOnly:= _
        False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
        "", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
        Format:=wdOpenFormatAuto

TTFN

RE: Opening a word document from excel using VBA

A big part of the answer depends on the level of interaction you want between the Excel and Word applications.

If all you want to do is open the Word document as a stand-alone application, then I would use the ShellExecute API using the name of the Word document.

On the other hand, if you want to open the document, and then manipulate the document from within the Excel application, then you will need to use the Word automation objects, as IRStuff has shown the beginnings of.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources