Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Word field code using VBA from Excel
I would like to export a variable number of chart pictures from Excel into a
Word document and give them a SEQ field number. Like so With WordApp.Selection .ParagraphFormat.Alignment = wdAlignParagraphCenter .Paste .TypeText Text:="Figure " .Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="SEQ FigNo \* Arabic" , PreserveFormatting:=True" End With However, I get a "Run-time error 438 : Object doesn't support this property or method" message. Does this mean I can never insert a field code in Word using VBA from Excel or is there another way to do it? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Word field code using VBA from Excel
Hi Barfbagger,
Unless you're using early binding, you can't use Word constants like wdAlignParagraphCenter and wdFieldEmpty - you have to use their numeric equivalents. -- Cheers macropod [Microsoft MVP - Word] "Barfbagger" wrote in message ... I would like to export a variable number of chart pictures from Excel into a Word document and give them a SEQ field number. Like so With WordApp.Selection .ParagraphFormat.Alignment = wdAlignParagraphCenter .Paste .TypeText Text:="Figure " .Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="SEQ FigNo \* Arabic" , PreserveFormatting:=True" End With However, I get a "Run-time error 438 : Object doesn't support this property or method" message. Does this mean I can never insert a field code in Word using VBA from Excel or is there another way to do it? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Import Table / Field Code Data from Word | Excel Programming | |||
Insert Field control in Word; Link to Excel Sheet | Excel Programming | |||
vba code to insert an range of Excel cells into a Word document | Excel Programming | |||
insert field from Word into Excel | Excel Worksheet Functions | |||
insert data into macro code from text input field? | Excel Programming |