Reply
 
Thread Tools Display Modes
  #1   Report Post  
Virgil
 
Posts: n/a
Default Mail Merge VBA problem in Word/Access 2003

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
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

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.

--
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
"Virgil" wrote in message
...
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



  #3   Report Post  
Virgil
 
Posts: n/a
Default

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.
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.

--
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
"Virgil" wrote in

message
...
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



.

  #4   Report Post  
Doug Robbins
 
Posts: n/a
Default

I can only repeat what I said before, there is nothing at all in that code
that has anything to do with mailmerge.

--
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
"Virgil" wrote in message
...
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.
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.

--
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
"Virgil" wrote in

message
...
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



.



  #5   Report Post  
Virgil
 
Posts: n/a
Default

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
that has anything to do with mailmerge.

--
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
"Virgil" wrote in

message
...
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.
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.

--
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
"Virgil" wrote in

message
.. .
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


.



.



  #6   Report Post  
Doug Robbins
 
Posts: n/a
Default

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.
--
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
"Virgil" wrote in message
...
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
that has anything to do with mailmerge.

--
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
"Virgil" wrote in

message
...
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.
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.

--
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
"Virgil" wrote in
message
. ..
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


.



.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge Word 2003 Issue S.Nicks Mailmerge 5 February 20th 09 01:55 AM
Mail Merge Final Step in Word 2003 XP blnorwood Mailmerge 2 January 14th 05 06:02 AM
Word-Excel 2003 - Mail Merge Recipients problem AYager Mailmerge 2 January 11th 05 04:11 AM
Exchange 2003 - Outlook 2003 - Word 2003 mail merge Micheline Mailmerge 1 December 2nd 04 11:51 AM
Mail Merge Problem Cindy M -WordMVP- Mailmerge 0 November 30th 04 05:25 PM


All times are GMT +1. The time now is 11:20 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"