Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / February 2005

Tip: Looking for answers? Try searching our database.

Mail Merge VBA problem in Word/Access 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Virgil - 07 Feb 2005 20:09 GMT
Folks, I'm tearing my hair out trying to find out WHY this
VBA code doesn't merge data into a Word 2003 template! The
code is used in an Access 2002 database. The variables are
fine.  It creates an active document from a template but
it does NOT merge the data.

With gappWord
.Selection.WholeStory
.Selection.Fields.Update
.Selection.HomeKey Unit:=wdStory
.ActiveDocument.SaveAs gstrJobsheetsPath & strNewFileName
.Visible = True
.ActiveWindow.WindowState = wdWindowStateMaximize
.Activate
End With
Doug Robbins - 07 Feb 2005 23:22 GMT
There's nothing at all in that code that has anything to do with mailmerge.
Did you post the right code?

Check out the Mailmerge item in the Visual Basic Help file for details on
how to use vba to execute a mail merge.

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> Folks, I'm tearing my hair out trying to find out WHY this
> VBA code doesn't merge data into a Word 2003 template! The
[quoted text clipped - 11 lines]
> .Activate
> End With
Virgil - 08 Feb 2005 15:21 GMT
Yes. That's code from the Access VBA using MS Word 9.0
Object Library.  Also shoudl have said that the code works
fine in Access 2000.  I'll post this problem in the Acess
area.

>-----Original Message-----
>There's nothing at all in that code that has anything to do with mailmerge.
[quoted text clipped - 20 lines]
>
>.
Doug Robbins - 09 Feb 2005 00:03 GMT
I can only repeat what I said before, there is nothing at all in that code
that has anything to do with mailmerge.

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> Yes. That's code from the Access VBA using MS Word 9.0
> Object Library.  Also shoudl have said that the code works
[quoted text clipped - 41 lines]
>>
>>.
Virgil - 09 Feb 2005 15:25 GMT
I'm not sure what your point is because this is actual VBA
code from an Access 2000 function which DOES execute a
mail merge in a Word 2000 document using an Excel
spreadsheet.  It based on code from Helen Feddema's
book "Expert One-on-One Microsoft Access Application
Development". Now this same code doesn't work in
Access/Word 2003 and I'm trying to find out what changes
to make to make it execute a mail merge rather that just
give me a new document that hasn't been merged with the
data source.
>-----Original Message-----
>I can only repeat what I said before, there is nothing at all in that code
[quoted text clipped - 47 lines]
>
>.
Doug Robbins - 10 Feb 2005 00:23 GMT
I cannot explain why it may have worked in Word 2000.  However, in all
versions of Word since Word 97, I would expect to see code something like
that which is included n the following exerpt from the Visual Basic Help
file:

Returns a MailMerge object that represents the mail merge functionality for
the specified document. Read-only.

Note  The MailMerge object is available regardless of whether the specified
document is a mail merge main document. Use the State property to determine
the current state of the mail merge operation.

Example
This example executes a mail merge if the active document is a main document
with an attached data source.

Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndDataSource Then myMerge.Execute
        This example merges the main document with data records 1 through 4 and
sends the merge documents to the printer.

With ActiveDocument.MailMerge
   .DataSource.FirstRecord = 1
   .DataSource.LastRecord = 4
   .Destination = wdSendToPrinter
   .SuppressBlankLines = True
   .Execute
End With
    There is nothing at all in the code that you have posted that refers to
Mailmerge.That is my point.
Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> I'm not sure what your point is because this is actual VBA
> code from an Access 2000 function which DOES execute a
[quoted text clipped - 72 lines]
>>
>>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.