Information générale
Catégorie:
COM/DCOM et OLE Automation
I am using Word 97. Obviously this is not my strong point, but the code says "createobject("word.basic")" not "createobject("word.application") and it calls ".MailMerge" prefixed methods that I guess are in a custom class (I do not know where to find it). What the code does that I like (the reason I am using it) is it will create a new document and associate it with a datasource. I do not know how to do that. But still I want to save the document (since my clients gave me a file name in a textbox) and I want to change the current directory (since they gave me a path in a textbox), but the "normal" way of doing that is not working:
oword.activedocument.saveas("c:\rt50v53\testmmsave.doc")
oword.ChangeFileOpenDirectory (word_directory)
Brenda
>What version of Word are you using? My syntax is for Word2000 which also applies to Word97 I think. What I do is:
>
>oWord = createobject("word.application")
>oDocument = oWord.Documents.Open(lcDocumentName)
>
>I thought your oWordDocument was an object reference to the document and not the Word application. With the 2 objects I created, I can reference the document in 2 ways -- oWord.ActiveDocument or oDocument.
>
>Now, I am not sure why you get an error with those 2 commands unless you are using an earlier version of Word where this has now changes.
>>**** Cetin MailMerge Class Code snippet
>>
>>oWordDocument=createobject("word.basic") && Create word object
>>
>>WITH oWordDocument
>>
>> if !empty(tcTemplate)
>> .filenew(tcTemplate) && open using template table
>> else
>> .filenewdefault && no template - new file
>> endif
>>
>> .MailMergeOpenDataSource(cDatasource,,, 1 ,,,,,,,;
>> cDSN+cSourceDb+cSourceType+cOther, cSQLStatement) && Open data source - Link >>to source
>> .MailMergeEditMainDocument && Activate the main document
>>
>>.activedocument.saveas("c:\rt50v53\testmmsave.doc") && not working
>>
>>ENDWITH
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement