Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE Container Control

Status
Not open for further replies.

KowCiller

Programmer
Aug 5, 2002
10
0
0
US
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top