Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

pasteNadFormat (wdChartPicture) does not work from .xla

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sajberjens - 07 Apr 2006 11:26 GMT
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
Helmut Weber - 07 Apr 2006 11:53 GMT
Hi,

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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

sajberjens@googlemail.com - 07 Apr 2006 13:36 GMT
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
Tony Jollans - 09 Apr 2006 21:12 GMT
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.

--
Enjoy,
Tony

> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.