Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369

    Question Unanswered: opening a word document by clicking a button

    Hi, what is the proper code to open a specific word document by clicking a button on a form?

    The code generated by the wizard to open Word (no doc option), is:

    Set oApp = CreateObject("Word.Application")
    oApp.Visible

    I am not getting any automatic suggestions if typing oApp. or putting commas behind the first sentence.

    K.

  2. #2
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: opening a word document by clicking a button

    Originally posted by kedaniel
    Hi, what is the proper code to open a specific word document by clicking a button on a form?

    The code generated by the wizard to open Word (no doc option), is:

    Set oApp = CreateObject("Word.Application")
    oApp.Visible

    I am not getting any automatic suggestions if typing oApp. or putting commas behind the first sentence.

    K.
    Hi K.

    In order to see the automatic suggestions you have to set a reference to the "Microsoft Word Object Library"... (Make sure a module is open, go to the Tools menu... Select Tools -> References ...and add a check mark next to "Microsoft Word 9.0 Object Library" - could be 8.0, 10.0, etc... depending on what version of Word you are running)

    As for opening the document... add the following line...
    oApp.Documents.Open("TheDocumentPath")

    HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •