Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Manipulating Word Header from VFP
Message
De
04/12/2000 13:41:11
 
 
À
04/12/2000 10:35:46
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00448787
Message ID:
00448976
Vues:
13
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform