This control has given me fits...
The whole idea here is this :
The users should be able to work with Microsoft Word inside my application, specifically mail merging with a Microsoft Excel spreadsheet (.xls file).
My form has an OLE Container control with a command button X.
Here's my code:
Private Sub X_Click()
Set wdApp = New Word.Application
Set wdDoc = New Word.Document
OLE1.CreateEmbed "c:\blank.doc" 'blank doc
With OLE1.object
.mailMerge.MainDocumentType = wdFormLetters
.mailMerge.OpenDataSource "c:\test.xls", readOnly:=True, linktosource:=True
.mailMerge.EditMainDocument
End With
OLE1.DoVerb vbOLEUIActivate
OLE1.DoVerb vbOLEShow
OLE1.DoVerb vbOLEInPlaceActivate
End Sub
It opens up excel and my spread sheet, and Excel (which i would like to all be hidden) and also the embedded word document does not have the toolbar for mail merges that would allow me to add a merge field.
Why do these toolbars not show up? Is there a different way to get what I want? Is there a way to get something similar through linking without my users leaving my application for Word?
Please help!
Thanks
Aaron.
The whole idea here is this :
The users should be able to work with Microsoft Word inside my application, specifically mail merging with a Microsoft Excel spreadsheet (.xls file).
My form has an OLE Container control with a command button X.
Here's my code:
Private Sub X_Click()
Set wdApp = New Word.Application
Set wdDoc = New Word.Document
OLE1.CreateEmbed "c:\blank.doc" 'blank doc
With OLE1.object
.mailMerge.MainDocumentType = wdFormLetters
.mailMerge.OpenDataSource "c:\test.xls", readOnly:=True, linktosource:=True
.mailMerge.EditMainDocument
End With
OLE1.DoVerb vbOLEUIActivate
OLE1.DoVerb vbOLEShow
OLE1.DoVerb vbOLEInPlaceActivate
End Sub
It opens up excel and my spread sheet, and Excel (which i would like to all be hidden) and also the embedded word document does not have the toolbar for mail merges that would allow me to add a merge field.
Why do these toolbars not show up? Is there a different way to get what I want? Is there a way to get something similar through linking without my users leaving my application for Word?
Please help!
Thanks
Aaron.