Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word and OLE
Message
De
02/11/1999 23:46:32
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
02/11/1999 20:20:46
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00284559
Message ID:
00285932
Vues:
19
Mary,
Full SaveAs syntax is :
SaveAs(FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter)
Translates the saveas line to :
.ActiveDocument.SaveAs(lcFileName,,,,,,.T.)
Cetin



>Thank you Cetin. Although I am quite a novice at this, I believe I understand your code :-) I will recreate it myself to 'see it in action'. Since my last message, I've installed Visual Studio 6.0 (professional Edition) and I have Word 2000. Things seem to be running smoother. I was able to open my template file, do a mailmerge and then do a FileSaveAs and create a new document with a 'product-specific' name. Now, how would I save this newly created document as 'Read Only'. I don't want the users to change it. (P.S. Thank you Erik, Barbara and David for responding.)
>
>
>>>Trying to automate that if a particular document isn't found, get the template and do a FileSaveAs and create it. Using oword.createobject("Word.Application"), and can open the file (Documents.open) but there's no SaveAs there. Used the Object Browser and found under "Document" a SaveAs, but can't get it to work. Not sure what I'm doing wrong. Really need to know how to change directories, FileSaveAs and run macros. Can Someone help? (God Bless whoever responds!)
>>
>>
Mary,
>>SaveAs method applies to Document object. Below sample code works with w97 and up and any version VFP :
PUBLIC oWord
>>
>>*** set the LOCALEID to English
>>nlLocaleId=sys(3004)	&& Save local id
>>=sys(3006,1033)		&& We will be sending instructions in English
>>USE customer		&& test table
>>Application.datatoclip()
>>WAIT window nowait "Creating Word Document..."
>>
>>oWord=createobject("word.application")	&& Create word object
>>WITH oWord
>>  .documents.add        	&& New file, default template
>>  .Selection.Paste
>>  .Selection.Goto(-1,,,"\StartOfDoc")
>>  #DEFINE wdDialogEditReplace 117
>>  WITH .dialogs(wdDialogEditReplace)
>>    .Find = "Owner"
>>    .Replace = "Çetin"
>>    .MatchCase = .f.
>>    .ReplaceAll = .t.
>>    .Execute
>>  ENDWITH
>>  .ActiveDocument.SaveAs("c:\temp\test.doc")
>>  .ActiveDocument.Close(-1)
>>  .Quit
>>ENDWITH
>>WAIT clear
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform