Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
Thread | Forum | |||
Mail Merge Word 2003 Issue | Mailmerge | |||
Mail Merge Final Step in Word 2003 XP | Mailmerge | |||
Word-Excel 2003 - Mail Merge Recipients problem | Mailmerge | |||
Exchange 2003 - Outlook 2003 - Word 2003 mail merge | Mailmerge | |||
Mail Merge Problem | Mailmerge |