Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import Table / Field Code Data from Word [email protected][_2_] Excel Programming 1 October 2nd 08 12:01 PM
Insert Field control in Word; Link to Excel Sheet ryguy7272 Excel Programming 3 November 20th 07 11:34 PM
vba code to insert an range of Excel cells into a Word document Peter Vaughton Excel Programming 0 January 15th 07 05:17 PM
insert field from Word into Excel Kaththea Excel Worksheet Functions 6 June 8th 05 06:56 PM
insert data into macro code from text input field? john_t_h[_15_] Excel Programming 1 January 16th 04 03:14 AM


All times are GMT +1. The time now is 01:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"