Hi Rafael
This id the way I would do it.
First open the document and locate the embedded image, note down it
properties. Then depending upon which version of Word (Office 2007 only
has macro recording in the higher versions) you need to start recording
a macro and pick up the logo and embed it into the header. Just follow
the manual procedure. Make sure you set the properties of the object
while recording. When the logo is embedded stop the recording and go to
edit the macro. Copy and paste the macro into FoxPro and edit it to
change the syntax.
You then need to add the commands to open word and run the macro.
#Declare wdPrintAllDocument 0
#Declare wdPrintDocumentContent 0
#Declare wdPrintAllPages 0
&& Check the above constant values with the object browser or Google
oleWord = CreateObject("Word.Application")
With oleWord
.Visible = .T.
.Documents.Open("NameAndPathOfDocument")
&& Macro contents here don't forget to put a . in front of the
Word statements where necessary
.Application.PrintOut("",wdPrintAllDocument,wdPrintDocumentContent,1,"",
wdPrintAllPages,ManualDuplexPrint,True,True,False,0,0,0,0)
EndWith
The Printout routine is for office 2007
If using earlier version use the macro recorder to find the correct
syntax.
I.e. in VBS the no of copies is Copies:=1 In VFP should just place the
no. of copies in the right place.
An example of the Printout code for Word below so you can see how it
needs to be changed.
****************************
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:=
_
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
****************************
Peter Hart
Peter Hart Computers.
If no one else comes up with a better solution and you want help.
Send me a copy of the document suitably edited if it is private, with
the logo embedded and I will create the VFP code to print it out with
other images embedded.
Sent by Rafael Copquin
Sent: 07 September 2009 18:46
Subject: vfp and automation
I have a client that generated hundreds of Word documents and all of
them have the company logo embedded in the document header. Now they
created a subsidiary company with a different logo and want to use the
same Word documents, except that the headers should show the new logo.
FYI, these documents have to do with internal procedures and special
manufacturing norms they have to follow to comply with GMP (good
manufacturing practices).
Can you guys give me a lead on how to automate the embedding process, so
as to replace the logo in each document for the logo in the copy?
The idea would be to replace the embedded logo by a link to the new
logo, just in case they decide to open a third subsidiary. They would
use the same documents and change the logo once more.
If you would show examples of code, it would be great.
TIA
Rafael Copquin
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/a57fa4cf19531343a2ee11b57db8e3af04c...@server.peterhartcomputers.local
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.