• Open from Template (2003 SP2)

    Author
    Topic
    #416657

    I’m trying to create a document from a template. Access keeps opening the word template rather than a new word document based off the template. Any ideas? Thanks in advance.

    Viewing 0 reply threads
    Author
    Replies
    • #932616

      How are you doing this? In VBA code? If so, please post (the relevant part of) the code you have now. If not, whay method are you using then?

      • #932618

        Sorry HansV, in VB. I shoplifted this off one of the post. This currently opens just the template.

        dim strworddoc as string
        ‘template
        strWordDoc = “H:DBsNAVSHIPYRDSS.dot”
        ‘Create a Word instance
        Set appWord = CreateObject(“Word.Application”)
        appWord.Visible = True
        ‘Open the selected merge document
        appWord.Documents.Open strWordDoc

        • #932637

          Use

          appWord.Documents.Add strWordDoc

          to create a new file.

          • #933371

            I’m getting closer on this. The word document opens now correctly (not the template) but still having problems. I’m using mail merge with the template. After populating the a merged table, access opens a new word document using the merged template. When access opens the document I still see all the field codes and can’t remove them, but when I open the document manually its correct with the proper data in place of the field codes. I’ m setting the merge up without code, perhaps that’s where my problem is. Any suggestions would be appreciated.

            • #933375

              Perhaps this is the problem. When I manually open the template creating a new document. Word asks
              “Opening this document will run the following command:
              Select * from [cur_ann_ltr]
              Data from the database wil be placed in the document. Do you wish to continue?”

              If I select no, the documents opens like it does when acess opens it.
              I believe access is not sending that “YES” during this prompt and assumes “NO”
              How would I get by this?

              Thanks in advance.

            • #933376

              I don’t know why that happens. Word should display the prompt even if the document is opened from Access.

              I never save a document with the merge data source myself, I set it in code from Access. See for example the links in post 414294.

            • #933378

              Thanks HansV, I’ll set it in code from Access like you said

    Viewing 0 reply threads
    Reply To: Open from Template (2003 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: