Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Manipulating Word Header from VFP
Message
From
04/12/2000 13:41:11
 
 
To
04/12/2000 10:35:46
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00448787
Message ID:
00448976
Views:
7
>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
>

Now that everyone else has told you how to fix the syntax, it's also worth pointing out that you're going the long way around to do this. You don't need to change to Page view and select the header. You can address it directly. Put this inside your WITH, replace all the lines beginning with .ActiveWindow...

oHeader = .ActiveDocument.Sections[1].Headers[1].Range
WITH oHeader
.InlineShapes.AddPicture("F:\Contacts\Graphics\ACERO1.BMP")
.ParagraphFormat.Alignment = wdAlignParagraphCenter
ENDWITH

(Note: this is untested, so you may have to tweak.)

Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform