Results 1 to 2 of 2
  1. #1
    andrejamih is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    15

    VBA Code for opening Word Document problem

    I have use this code for opening a word document, but when the Word Document started, it "forgot" mail merge process which I set on document.

    How to set a code under button on my form to open a word document and to NOT forget a Mail Merge process. The best option could be to automatically open a Mail Merge Tab on Word document.

    If somebody could help me, I'd really appreciate that. I find in my seeking for better option some bookmarks mailing or automation, but I couldn't develop that on myself, but if somebody know coding for that it will be maybe better idea.

    Option Compare Database
    Option Explicit






    Private Sub Command205_Click()


    Dim LWordDoc As String
    Dim oApp As Object


    LWordDoc = "Z:\Razmena\Andra\4.1.1. - WORK ORDER LISTA - RADNA.docx"
    If Dir(LWordDoc) = "" Then
    MsgBox "Document not found."
    Else


    Set oApp = CreateObject(Class:="Word.Application")
    oApp.Visible = True
    oApp.Activate
    oApp.WindowState = wdWindowStateMaximize
    oApp.Documents.Open FileName:=LWordDoc


    End If
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    in word, you must start your Mail Merge,
    create your document,build the merge layout,
    then Save this document. (before the actual merge)

    When you open the doc again, THEN you can run the merge.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 06-27-2017, 12:06 PM
  2. Replies: 1
    Last Post: 03-10-2017, 11:02 AM
  3. Replies: 4
    Last Post: 07-25-2014, 06:11 AM
  4. Code to print 'section' of a word document.
    By TurnipGrnPeace in forum Access
    Replies: 6
    Last Post: 06-25-2013, 07:17 PM
  5. Replies: 3
    Last Post: 02-22-2013, 06:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums