Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open from Template (2003 SP2)

    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.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Open from Template (2003 SP2)

    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?

  3. #3
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open from Template (2003 SP2)

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

    dim strworddoc as string
    'template
    strWordDoc = "HBsNAVSHIPYRDSS.dot"
    'Create a Word instance
    Set appWord = CreateObject("Word.Application")
    appWord.Visible = True
    'Open the selected merge document
    appWord.Documents.Open strWordDoc

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Open from Template (2003 SP2)

    Use

    appWord.Documents.Add strWordDoc

    to create a new file.

  5. #5
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open from Template (2003 SP2)

    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.

  6. #6
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open from Template (2003 SP2)

    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.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Open from Template (2003 SP2)

    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>post 414294</post#>.

  8. #8
    Star Lounger
    Join Date
    Apr 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open from Template (2003 SP2)

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

Posting Permissions

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