Results 1 to 4 of 4
  1. #1

    Using a command button to open a merged file

    A programmer created a database for my company and I added a command button with the following code:
    Dim WOrdApp As New Word.Application
    Dim doc As Word.Document

    WOrdApp.Documents.Open "C:My DocumentsNewClmtwithPCP.doc"
    Set doc = WOrdApp.ActiveDocument
    doc.CLOSe SaveChanges:=wdDoNotSaveChanges
    WOrdApp.Visible = True
    WOrdApp.WindowState = wdWindowStateMaximize

    This code worked great in his database but now I am making a database of my own and it won't work. It won't even recognize: Dim WordApp As New Word.Document
    It's like I don't have the option of Word.Document.
    Any suggestions?
    I just want to open a merged word file from a command button.

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Thanked 0 Times in 0 Posts

    Re: Using a command button to open a merged file

    You might need to open a module or code, then select Tools-References.

    Check the box for Microsoft Word Object Library (it will have a version #, depending on which you are using)

  3. #3

    Re: Using a command button to open a merged file

    Thank you! I can now use that code. The only problem is I am merging about 300 letters and it takes 6-7 minutes to merge using my command button. Is there any way to speed things up?

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Using a command button to open a merged file

    One way is to not use Access as the datasource for the mail merge. Instead, export the data to be merged to a Word mailmerge format (that is, tab delimited text) file and make that the source for your merge. I've never had much luck trying to do large merges with an Access datasource, although I haven't tried it with Office 2000, which handles the interaction a little differently. With Office 97, Word launched a second instance of Access to provide its data and between the two (three?) applications, it could bring a PC to its knees (figuratively speaking, of course).

Posting Permissions

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