Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Manipulating Word Header from VFP
Message
From
04/12/2000 11:19:38
 
 
To
04/12/2000 10:35:46
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00448787
Message ID:
00448833
Views:
9
>>>>>>>>>>>>>>>>
I am trying to create a Word document and add an image to its header. Below is the code I am using:
oWord=CREATEOBJECT("Word.Application")
WITH oWord
  .Visible=.T.
  .WindowState = wdWindowStateMaximize
  .Documents.Add("f:\contacts\docs\test.dot")
  .ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
  .Selection.InlineShapes.AddPicture FileName:="F:\Contacts\Graphics\ACERO1.BMP"_
    ,LinkToFile:=False, SaveWithDocument:=True
  .Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 ENDWITH
When I run this code I am getting a syntax error on the following portion:
  .Selection.InlineShapes.AddPicture FileName:="F:\Contacts\Graphics\ACERO.BMP"_
     ,LinkToFile:=False, SaveWithDocument:=True
I recorded a macro in Word while inserting the image into the header and this is the code hat it produced. What am I doing wrong? Any help would be greatly appreciated.
>>>>>>>>>>>>>

You are using VBA syntax, no VFP syntax.
If you want to break the line in 2 you must change the '_' to ';'
More importantly, you cannot pass named parameters like you do in that line.
In VFP just pass them w/o the name, but in the proper order that is.
And you cannot call it as a statement but as like a VFP function

In you example, try instead:
  .Selection.InlineShapes.AddPicture("F:\Contacts\Graphics\ACERO.BMP",.F., .T.)
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Reply
Map
View

Click here to load this message in the networking platform