Results 1 to 2 of 2
  1. #1
    M.Enders is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    9

    Access Form to Word

    I have no idea what I am doing wrong.
    I have a simple form with a button

    Click image for larger version. 

Name:	Capture2.PNG 
Views:	10 
Size:	4.8 KB 
ID:	35815
    When I hit said button I would like access to auto populate multiple word forms but I keep running into an issue when I try with just one word document:

    Private Sub Command12_Click()

    Dim wApp As Word.Application
    Dim wDoc As Word.Document

    Set wApp = New Word.Application
    Set wDoc = wApp.Documents.Open("C:\Supply_Excellence\_LOGISTI CS CONTINUITY\Documents\Cyclic_Inventory_Memorandum.d oc")

    With wDoc
    .Bookmarks("Lin1").Range.Text = Nz(Me.Text4, "")
    .Bookmarks("Lin2").Range.Text = Nz(Me.Text6, "")


    .SaveAs2 ("C:\Supply_Excellence\_LOGISTICS CONTINUITY\Inventories\Cyclic_Memo_Unsigned_" & Format(Now(), "yyyymmdd") & ".doc")

    .Bookmarks("Lin1").Range.Delete wdCharacter, Len(Nz(Me.Text4, ""))
    .Bookmarks("Lin2").Range.Delete wdCharacter, Len(Nz(Me.Text6, ""))

    End With

    DoCmd.Requery
    DoCmd.OpenReport "ReportCYCLINS", acViewPreview

    wDoc.Close
    wApp.Quit

    End Sub


    however access is not filling in the bookmarks with the data from the forms text boxes. These are unbounded text boxes and not related to any table.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I've done very little Word automation, but I have this that worked (this is just the part populating bookmarks, Wrd is the Word object):

    Wrd.ActiveDocument.Bookmarks("DriverName1").Select
    Wrd.Selection.text = rs!First_Name & " " & rs!LastName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Import Word form to Access form as new record (user friendly)
    By bbrazeau in forum Import/Export Data
    Replies: 1
    Last Post: 04-30-2013, 12:00 PM
  2. Access to Word - Multiple Word Templates?
    By alpinegroove in forum Programming
    Replies: 11
    Last Post: 06-12-2012, 04:42 PM
  3. Access to Word Form Fill
    By defy in forum Programming
    Replies: 1
    Last Post: 10-04-2011, 12:10 AM
  4. Copying Access Form to a Word Doc
    By sxottwc in forum Forms
    Replies: 3
    Last Post: 07-16-2011, 06:19 PM
  5. Access Form to Word Bookmarks
    By markod in forum Forms
    Replies: 5
    Last Post: 12-27-2010, 05:18 PM

Tags for this Thread

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