Hi all,
Not sure if this is the correct place to post this, but here goes anyway.
I'm performing a basic a mail merge from Access into Word, ceating the merge document on the fly in
VB. This isn't a problem, as I can run right through and execute the merge successfully.
What I want be be able to do in addition, is carry out a merge to generate a letter template, and then leave word open to fillout the contents of the letter (ie. set up the datasource and some basic formatting, and then leave Word with the pre-merged document to add the content).
Now I thought this would be simple, and it is (in essence), but for some reason, when I specify a data source in
VB, Word decides that I don't want any menus or toolbars anymore, and I can't find a way of getting them back. As a result, I have no way of formatting the letter or carrying out the merge!
Is there any way to restor toolbars (looked through the Word object browser, and can't find anything suitable).
To try and explain this better, here are a couple of bits of code
1. This opens word and creates me a new mailmerge doc, leaving the menus alone
Dim app As Object
Dim doc As Object
Set app = CreateObject("Word.Application")
Set doc = app.Documents.Add
With doc
.MailMerge.MainDocumentType = wdFormLetters
.MailMerge.EditMainDocument
'Perform some basic text isnertion and formatting here...
End With
app.Visible = True
'User now has the document ready to edit and subsequently merge
2. Once I add code to open a datasource, all the menus disappear!
Dim app As Object
Dim doc As Object
Set app = CreateObject("Word.Application")
Set doc = app.Documents.Add
With doc
.MailMerge.MainDocumentType = wdFormLetters
.MailMerge.OpenDataSource Name:=CurrentDb.Name, sqlStatement:="Select * from [My Query]"
.MailMerge.EditMainDocument
'Perform some basic text isnertion and formatting here...
End With
app.Visible = True
'User now has the document ready to edit and subsequently merge
'But all the toolbars and menus have gone!!
Any help much appreciated
Cryolith