DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: MS Access 2013 VBA replace bookmarks

  1. #1
    Join Date
    Nov 2014

    MS Access 2013 VBA replace bookmarks

    Below is the code that I have used and it works with one problem, it seems to keep Access looping and not running the code. There is a pop-up, but I can't get to it because I can't do anything in Access. The table "report emails" has all the email address, subjects, attachment locations, and type of report the attachment is(i.e. Fills or Open orders). "Sub" is the type of report i'm inserting into the letter I'm printing out here and "whatitis" is the name of the bookmark. I will be emailing this once I figure this part out. The pop-up is asking if I should open as read-only, merge changes, or something else. When I do get to it and select read-only, it does print it out correctly. What do I need it to do select that option automatically?

    Private Sub Command68_Click()
    Dim var As String
    Dim mydb As Database
    Dim myrec As Recordset

    Set mydb = CurrentDb
    Set myrec = mydb.OpenRecordset("report emails")
    myrec.Move first
    Do Until myrec.EOF

    var = myrec!Sub
    Dim Wrd As Word.Application
    Set Wrd = CreateObject("Word.Application")

    With Wrd
    .Documents.Open FileName:="w:\statements\email.dotx"
    .Selection.GoTo wdGoToBookmark, , , "whatitis"
    .Selection.Text = var
    .ActiveDocument.Close (False)
    End With
    End Sub

  2. #2
    Join Date
    Nov 2014
    With Wrd
    .Documents.Open FileName:="w:\statements\email.dotx", ReadOnly:=True

    I got it to work. Does anyone understand mailmerge? I want to email reports(pdfs) using the letters i created using the above codes as the email message with a pdf attached using the table.

Similar Threads

  1. Replies: 1
    Last Post: 05-04-2014, 11:27 PM
  2. Replies: 1
    Last Post: 10-08-2005, 10:29 AM
  3. Replies: 1
    Last Post: 03-02-2005, 04:38 AM
  4. Access Bookmarks/Recordset Clones with Subforms
    By Jeff Johnson in forum VB Classic
    Replies: 2
    Last Post: 01-27-2001, 10:34 PM
    By Vicki in forum XML
    Replies: 1
    Last Post: 08-02-2000, 01:24 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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center