Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Office Automation
Message
De
08/10/2003 10:54:35
 
 
À
08/10/2003 10:30:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00836175
Message ID:
00836238
Vues:
12
>>>>I am working with office automation. I am trying to pull up a document for word. The data source is linked in the document. It opens fine, does the merge fine, etc. The only thing is when I open it, I get a read only/file in use dialog for the document and then for the data source itself. It is almost like VFP actually uses it before it pulls it up and then will see it as already being in use by yourself. The other problem I am having is after the merge document is created, I would like to keep that avalible with the ability to change, save it, etc., but I want to close the actual form document (showing merge fields, etc.) itself and only show the result (merged document). I have the Microsoft Office Automation for Visual Foxpro book, but I can't seem to find the syntax for closing the form document and leaving the merged document up. Does anyone know what the command is? Can someone help me get rid of the readonly/fileinuse boxes on open?
>>>
>>>Kevin,
>>>Use a template file (.Documents.Add(lcTemplate) vs .Documents.Open(lcDoc)). Cetin
>>
>>_________________________________________________________
>>Cetin,
>>
>> That helped with my read only / file open thing, thanks a lot. I still have the problem with the template remaining open along with the merged document. How can I close the template document leaving up the merged one for editing, save, etc.?
>
>You mean the main template itself or the one merged as a new doc ? I think main template :
>
>
>#Define wdSendToNewDocument  0
>#DEFINE wdDoNotSaveChanges	0	
>
>oWordDocument=Createobject("word.application")	&& Create word object
>With oWordDocument
>*...
>  With .ActiveDocument.MailMerge
>*....
>    .Destination = wdSendToNewDocument
>    .Execute
>  EndWith
>  .Visible = .T.
>  .Activate
>  .Documents(2).Saved=.t.
>  .Documents(2).Close(wdDoNotSaveChanges)
>Endwith
>
Cetin

I got the concept, yes I wanted to close the main document (template) but leave the new merged document open. Thanks a lot. Course I had to alter a little from what you gave me, but I got enough of it to what I needed to. I am trying to understand the logic on this though. Using the with on the created word document we make it visible, I left out the .documents(2).saved=.t. and I was not sure what this did and didn't need it. I understand the define sets up the parameter sent to close and tells it to not save any changes and the close syntax. What is the (2) parameter following the .Documents for?
``` Appreciate a normal day, it is always better than a bad one ```

Kev
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform