pasteNadFormat (wdChartPicture) does not work from .xla

S

sajberjens

I've written a bit of code that pops a chart from Excel into some
insertion point as follows:

With WordApp
.Activate
.ActiveDocument.Bookmarks(foo).Select
.Selection.PasteAndFormat (wdChartPicture)
End With

This works admirably well as long as it's executed from a module in a
..xls file but as soon as I put the code into a .xla I get

Compile error: variable not defined

with the debugger pointing to wdChartPicture...

I'm stumped -- any clues?

Thanks!

Jens
 
H

Helmut Weber

Hi,

I'd say in your xla their is no reference set
to the word library.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
S

sajberjens

I definitely have the Word Library referenced. If I comment out the
PasteAndFormat line and replace it with a selection.typetext line it
works fine. Something deeply Microsoft is going on...

Jens
 
T

Tony Jollans

Are you absolutely sure you have a reference to the Word library (Tools >
References)? The symptom - wdChartPicture not defined - is what would be
expected if it were not referenced.

..Selection.Typetext will work just fine with late binding and is not in any
way indicative of having the reference set.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top