Template with VBA code works differently in Word 2003

M

Microsoft

I'm new to the list and a novice at vba so I hope this is clear...Thanks in
advance.

I have some doc. templates with vb code that brings in data from a .csv,
names and saves the doc. In word 2003 i am getting a new dialog...

'opening this document will run the following sql command
select * from C:\Program Files\Filemaker\etc\TempleteMerge.mer
Data from you database will be placed in the document. Do you want to
continue?'

Is there any way to supress it...

here's the code:

Sub AutoNew()

Open "C:\Program Files\Filemaker\templetmerge.csv" For Input As #1
Input #1, ClientName, Sal, First, Last, Lbl_Address, Lbl_addressee,
FileDate, _
FileSubject, FileNameID, FileSaveLoc, FileSubDir, ApptDate, ApptTime, Plan,
PlanNbr
Close #1

ActiveDocument.MailMerge.OpenDataSource _
Name:="C:\Program Files\Filemaker\TempleteMerge.mer"

ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdtogglefieldcodes

ActiveDocument.Fields.Update

ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument

ActiveDocument.SaveAs FileName:=FileSaveLoc & "\" & FileNameID & ".doc"

ActiveDocument.Versions.Save Comment:="Company: " & ClientName & Chr(10) &
"letter to: " & First & _
" " & Last & Chr(10) & " Subject: " & FileSubject & Chr(10) & " Date: " &
FileDate

ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle) = FileSubDir & "
Letter"
ActiveDocument.BuiltInDocumentProperties(wdPropertySubject) = FileSubject
ActiveDocument.BuiltInDocumentProperties(wdPropertyCompany) = ClientName
ActiveDocument.BuiltInDocumentProperties(wdPropertyComments) = "Sent on: " _
& FileDate & Chr(10) & " TO: " & First & " " & Last

End Sub
 
C

Cindy M -WordMVP-

Hi Microsoft,
I'm new to the list and a novice at vba so I hope this is clear...Thanks in
advance.

I have some doc. templates with vb code that brings in data from a .csv,
names and saves the doc. In word 2003 i am getting a new dialog...

'opening this document will run the following sql command
select * from C:\Program Files\Filemaker\etc\TempleteMerge.mer
Data from you database will be placed in the document. Do you want to
continue?'

Is there any way to supress it...
See this KB article

"Opening This Will Run the Following SQL Command" Message When You Open a Word
Document - 825765
http://support.microsoft.com?kbid=825765

It's not clear when you're seeing this message, though. You shouldn't be
seeing it at all if you're opening the document using code. Only the user
should be seeing the message, when opening a mail merge document connected to
a data source.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
J

John Morina

Cindy & Peter,

Thanks for your response. I should have searched the knowledge base...

The user is getting the message and as this is intended behavior I think I
will just instruct them to click OK. They already do that to run the macro.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top