Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Word Document that shows Excel Chart

Hi

Here is a sample code.
[Here the book2.xls located on c: have a chart on sheet1]

Private Sub Command2_Click()
Dim wd As Word.Application
Dim exapp As Excel.Application
Set wd = New Word.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book2.xls"
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
wd.Visible = True
wd.Documents.Add.Content.PasteSpecial link:=True, DataType:=0
End Sub

Please have a try and let me if this does the job for you.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
From: "hmmm..."
Newsgroups:

microsoft.public.word.oleinterop,microsoft.public. word.vba.general,microsoft
public.word.word97vba,microsoft.public.excel.chart ing,microsoft.public.exce
l.misc,microsoft.public.excel.programming
Subject: Word Document that shows Excel Chart
Lines: 8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Message-ID: et
Date: Wed, 20 Aug 2003 17:21:52 GMT
NNTP-Posting-Host: 209.178.190.87
X-Complaints-To:
X-Trace: newsread4.news.pas.earthlink.net 1061400112 209.178.190.87 (Wed,

20 Aug 2003 10:21:52 PDT)
NNTP-Posting-Date: Wed, 20 Aug 2003 10:21:52 PDT
Organization: EarthLink Inc. --
http://www.EarthLink.net
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!newsfeed.freenet.de!newsfeed.news2me.com!elnk-nf2-pas!newsfeed.earthlin
k.net!stamper.news.pas.earthlink.net!newsread4.new s.pas.earthlink.net.POSTED
!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.word.vba.general:41111

microsoft.public.word.word97vba:68352 microsoft.public.excel.charting:32887
microsoft.public.excel.misc:266349
microsoft.public.excel.programming:408492
microsoft.public.word.oleinterop:8588
X-Tomcat-NG: microsoft.public.excel.programming

I would like to launch an Excel workbook from a Word document. The

workbook
updates a chart when the workbook is started. The chart must be displayed
in the Word document.Can anyone point me in the right direction, or show me
an example piece of code?

Thanks.







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Word Document that shows Excel Chart

Hi,

I had a problem with your example. I get a compile error at "Dim exapp As
Excel.Application".

Compile error:
User-defined type not defined

Do you know why?


It seems that you have not make reference to the Microsoft Excel Object
Library. You may do that by following the steps below.
1. Open the word application and Press Alt +F11, this will open Visual
Basic for Editor.
2. Select Tool/reference menu and check the Microsoft Excel 10.0 Object
Library<because mine is office 2002, so the version is 10.0
3. Copy and paste the code below to the Editor
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book2.xls" 'you may need to establish a book2.xls
first, which include a chart in sheet1
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
Application.ActiveDocument.Content.PasteSpecial Link:=True,
DataType:=wdPasteOLEObject
exapp.quit
set exapp = Nothing
End Sub
4. Press F5 to run the macro.

You may have a try and let me know if this does the job for you.

Also, is your command button in a Word document or and Excel workbook? I
want the end user to open up a Word document. The button should be in the
Word document and should cause the Excel chart to appear in a predetermined
place. It looks like your example creates a new Word document and displays
the chart in that document. I don't think that will work for me.


I create the sample code in VB6 not in the VBA editor of word, I am sorry
for confusion. You may refer to code above , when you run the macro above
will insert an excel chart object as a OLE object into word.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "hmmm..."
Newsgroups:

microsoft.public.excel.programming,microsoft.publi c.word.oleinterop,microsof
t.public.word.vba.general,microsoft.public.word.wo rd97vba,microsoft.public.e
xcel.charting,microsoft.public.excel.misc
References: et


Subject: Word Document that shows Excel Chart
Lines: 97
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4922.1500
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800
Message-ID: . net
Date: Mon, 25 Aug 2003 16:54:12 GMT
NNTP-Posting-Host: 209.179.228.32
X-Complaints-To:
X-Trace: newsread4.news.pas.earthlink.net 1061830452 209.179.228.32 (Mon,

25 Aug 2003 09:54:12 PDT)
NNTP-Posting-Date: Mon, 25 Aug 2003 09:54:12 PDT
Organization: EarthLink Inc. --
http://www.EarthLink.net
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!nntp-relay.ihug.net!ihug.co.nz!logbridge.uoregon.edu!ne wshub.sdsu.edu!e
lnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthl ink.net!newsread4.
news.pas.earthlink.net.POSTED!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.word.oleinterop:8611

microsoft.public.word.vba.general:41322
microsoft.public.word.word97vba:68370 microsoft.public.excel.charting:33006
microsoft.public.excel.misc:267255 microsoft.public.excel.programming:409816
X-Tomcat-NG: microsoft.public.excel.programming

I had a problem with your example. I get a compile error at "Dim exapp As
Excel.Application".

Compile error:
User-defined type not defined

Do you know why?

Also, is your command button in a Word document or and Excel workbook? I
want the end user to open up a Word document. The button should be in the
Word document and should cause the Excel chart to appear in a predetermined
place. It looks like your example creates a new Word document and displays
the chart in that document. I don't think that will work for me.

Thanks.

"Peter Huang [MSFT]" wrote in message
...
Hi

Here is a sample code.
[Here the book2.xls located on c: have a chart on sheet1]

Private Sub Command2_Click()
Dim wd As Word.Application
Dim exapp As Excel.Application
Set wd = New Word.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book2.xls"
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
wd.Visible = True
wd.Documents.Add.Content.PasteSpecial link:=True, DataType:=0
End Sub

Please have a try and let me if this does the job for you.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no

rights.

--------------------
From: "hmmm..."
Newsgroups:


microsoft.public.word.oleinterop,microsoft.public .word.vba.general,microsof

t

.public.word.word97vba,microsoft.public.excel.cha rting,microsoft.public.exc

e
l.misc,microsoft.public.excel.programming
Subject: Word Document that shows Excel Chart
Lines: 8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Message-ID: et
Date: Wed, 20 Aug 2003 17:21:52 GMT
NNTP-Posting-Host: 209.178.190.87
X-Complaints-To:
X-Trace: newsread4.news.pas.earthlink.net 1061400112 209.178.190.87

(Wed,
20 Aug 2003 10:21:52 PDT)
NNTP-Posting-Date: Wed, 20 Aug 2003 10:21:52 PDT
Organization: EarthLink Inc. --
http://www.EarthLink.net
Path:


cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli

n

e.de!newsfeed.freenet.de!newsfeed.news2me.com!eln k-nf2-pas!newsfeed.earthli

n

k.net!stamper.news.pas.earthlink.net!newsread4.ne ws.pas.earthlink.net.POSTE

D
!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.word.vba.general:41111

microsoft.public.word.word97vba:68352

microsoft.public.excel.charting:32887
microsoft.public.excel.misc:266349
microsoft.public.excel.programming:408492
microsoft.public.word.oleinterop:8588
X-Tomcat-NG: microsoft.public.excel.programming

I would like to launch an Excel workbook from a Word document. The

workbook
updates a chart when the workbook is started. The chart must be

displayed
in the Word document.Can anyone point me in the right direction, or show

me
an example piece of code?

Thanks.











  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Word Document that shows Excel Chart

Hi

1. What must I do to get the Excel application to understand the calls to
the DDE server when opened from the Word application?


To isolate the problem, I want to collect some information.
1. What error message do you get in your "real" Excel application?
2. You may try to set the exapp.visible to true to see if the problem
persists.
e.g.
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
Exapp.visible = true
exapp.Workbooks.Open "c:\book2.xls" 'you may need to establish a book2.xls
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
Application.ActiveDocument.Content.PasteSpecial Link:=True,
DataType:=wdPasteOLEObject
exapp.ActiveWorkbook.Saved = True
exapp.Quit
Set exapp = Nothing
End Sub
3. You may try to open the excel application and then open the workbook by
automation, and then call the macro that will retrieve data from DDE.
e.g. exapp.Run "a.xls!testmacro" ' the testmacro is one module macro in
the a.xls file.



2. From the Word application, how do I position the Excel chart at a
certain place on a certain page?

You may try to set a bookmard first and then used the code below to locate
and paste what you want.
e.g.
Selection.GoTo What:=wdGoToBookmark, Name:="test" ' the test is a
bookmark you have set before.
Selection.Paste ' you may use paste or pastespecial method

3. How can the Word application suppress the prompt to "Save Changes" when
quitting the Excel application. I do not want the changes to be saved when
Excel quits.You can set this Saved Property of workbook to True if you

want to close a modified workbook without either saving it or being
prompted to save it.
e.g.
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book2.xls" 'you may need to establish a book2.xls
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
Application.ActiveDocument.Content.PasteSpecial Link:=True,
DataType:=wdPasteOLEObject
exapp.ActiveWorkbook.Saved = True
exapp.Quit
Set exapp = Nothing
End Sub


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
From: "hmmm..."
Newsgroups:

microsoft.public.word.oleinterop,microsoft.public. word.vba.general,microsoft
.public.word.word97vba,microsoft.public.excel.char ting,microsoft.public.exce
l.misc,microsoft.public.excel.programming
References: et


. net

Subject: Word Document that shows Excel Chart
Lines: 66
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4922.1500
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800
Message-ID: et
Date: Wed, 27 Aug 2003 02:50:17 GMT
NNTP-Posting-Host: 209.179.141.125
X-Complaints-To:
X-Trace: newsread3.news.pas.earthlink.net 1061952617 209.179.141.125 (Tue,

26 Aug 2003 19:50:17 PDT)
NNTP-Posting-Date: Tue, 26 Aug 2003 19:50:17 PDT
Organization: EarthLink Inc. --
http://www.EarthLink.net
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!newsfeed.freenet.de!213.253.16.105.MISMATCH!m ephistopheles.news.clara.n
et!news.clara.net!colt.net!nycmny1-snf1.gtei.net!nycmny1-snh1.gtei.net!crtnt
x1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com !easynews.com!easynews!
elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthl ink.net!newsread3
.news.pas.earthlink.net.POSTED!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.word.vba.general:41415

microsoft.public.word.word97vba:68372 microsoft.public.excel.charting:33055
microsoft.public.excel.misc:267741
microsoft.public.excel.programming:410372
microsoft.public.word.oleinterop:8621
X-Tomcat-NG: microsoft.public.excel.programming

Hi,

I followed your instructions and was able to open the Excel application

from
the Word application (I got it to work with Microsoft Excel 9.0 Object
Library- Office 2000). I did this with a "test" Excel application that

uses
workbook_open() to modify the chart when the Excel workbook is opened.
Everything works fine in my test example.

When I changed the macro in the Word document to reference my "real" Excel
application, I got an error. The "real" Excel application has a 3rd party
add-in that has an interface to a DDE server (on request, the DDE server
returns data from an outside source). In workbook_open(), a request is made
to retrieve data from the DDE server. This call fails. So the Excel
application works fine stand-alone, but when it is opened from the Word
document, it doesn't understand the calls to the DDE server.

1. What must I do to get the Excel application to understand the calls to
the DDE server when opened from the Word application?

2. From the Word application, how do I position the Excel chart at a
certain place on a certain page?

3. How can the Word application suppress the prompt to "Save Changes" when
quitting the Excel application. I do not want the changes to be saved when
Excel quits.

Thanks!

"Peter Huang [MSFT]" wrote in message
...
Hi,

It seems that you have not make reference to the Microsoft Excel Object
Library. You may do that by following the steps below.
1. Open the word application and Press Alt +F11, this will open Visual
Basic for Editor.
2. Select Tool/reference menu and check the Microsoft Excel 10.0 Object
Library<because mine is office 2002, so the version is 10.0
3. Copy and paste the code below to the Editor
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book2.xls" 'you may need to establish a

book2.xls
first, which include a chart in sheet1
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
Application.ActiveDocument.Content.PasteSpecial Link:=True,
DataType:=wdPasteOLEObject
exapp.quit
set exapp = Nothing
End Sub
4. Press F5 to run the macro.

You may have a try and let me know if this does the job for you.

I create the sample code in VB6 not in the VBA editor of word, I am sorry
for confusion. You may refer to code above , when you run the macro above
will insert an excel chart object as a OLE object into word.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no

rights.
--------------------





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Word Document that shows Excel Chart

Hi,

The error:

Run-time error '1004'
Tne macro 'xyzCreate' cannot be found.

occurs when the following is executed in workbook_open() of the Excel
workbook.

Range("A1").Select
ActiveCell.Formula = the_query_string
Selection.Application.Run "xyzCreate"

This works fine when the workbook is opened in Excel. When Word tries to
open it from a macro, the error occurs. I almost seems like the Excel
add-in or some library no longer exists or is invisible when the Excel app
is started from a Word macro.

Thanks.

By the way, your suggestion for positioning the Excel chart within Word
using a bookmark worked. Also, your suggestion for closing the Excel app
from Word without prompting for "Save", by setting the Saved property to
true also worked. Thanks.


"Peter Huang [MSFT]" wrote in message
...
Hi

1. What must I do to get the Excel application to understand the calls

to
the DDE server when opened from the Word application?


To isolate the problem, I want to collect some information.
1. What error message do you get in your "real" Excel application?
2. You may try to set the exapp.visible to true to see if the problem
persists.
e.g.
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
Exapp.visible = true
exapp.Workbooks.Open "c:\book2.xls" 'you may need to establish a book2.xls
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
Application.ActiveDocument.Content.PasteSpecial Link:=True,
DataType:=wdPasteOLEObject
exapp.ActiveWorkbook.Saved = True
exapp.Quit
Set exapp = Nothing
End Sub
3. You may try to open the excel application and then open the workbook by
automation, and then call the macro that will retrieve data from DDE.
e.g. exapp.Run "a.xls!testmacro" ' the testmacro is one module macro in
the a.xls file.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Word Document that shows Excel Chart

Hi,

Where was the Macro "xyzCreate" located in? I have made a test that
automation a excel from work, I can not reproduce the problem you
encounter. Here is my test code.
[Word Macro]
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book1.xls"
exapp.Visible = True
End Sub

[Excel Macro,book1.xls]
Sub testex()
MsgBox "hello"
End Sub

Private Sub Workbook_Open()
Range("a1").Select
Selection.Application.Run "testex"
End Sub

You may have a try and let me the result.

Also, when you excel application run, the addin or library needed to run
your macro is loaded aumatically, i.e if you start up the excel
application, the addin or library has been loaded?


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "hmmm..."
Newsgroups: microsoft.public.excel.programming
References: et


. net

et

Subject: Word Document that shows Excel Chart
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4922.1500
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800
Message-ID: . net
Date: Wed, 27 Aug 2003 16:13:33 GMT
NNTP-Posting-Host: 209.178.188.215
X-Complaints-To:
X-Trace: newsread4.news.pas.earthlink.net 1062000813 209.178.188.215 (Wed,

27 Aug 2003 09:13:33 PDT)
NNTP-Posting-Date: Wed, 27 Aug 2003 09:13:33 PDT
Organization: EarthLink Inc. --
http://www.EarthLink.net
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!newsfeed.freenet.de!newsfeed.news2me.com!elnk-nf2-pas!newsfeed.earthlin
k.net!stamper.news.pas.earthlink.net!newsread4.new s.pas.earthlink.net.POSTED
!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.excel.programming:410564
X-Tomcat-NG: microsoft.public.excel.programming

Hi,

The error:

Run-time error '1004'
Tne macro 'xyzCreate' cannot be found.

occurs when the following is executed in workbook_open() of the Excel
workbook.

Range("A1").Select
ActiveCell.Formula = the_query_string
Selection.Application.Run "xyzCreate"

This works fine when the workbook is opened in Excel. When Word tries to
open it from a macro, the error occurs. I almost seems like the Excel
add-in or some library no longer exists or is invisible when the Excel app
is started from a Word macro.

Thanks.

By the way, your suggestion for positioning the Excel chart within Word
using a bookmark worked. Also, your suggestion for closing the Excel app
from Word without prompting for "Save", by setting the Saved property to
true also worked. Thanks.


"Peter Huang [MSFT]" wrote in message
...
Hi

1. What must I do to get the Excel application to understand the calls

to
the DDE server when opened from the Word application?


To isolate the problem, I want to collect some information.
1. What error message do you get in your "real" Excel application?
2. You may try to set the exapp.visible to true to see if the problem
persists.
e.g.
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
Exapp.visible = true
exapp.Workbooks.Open "c:\book2.xls" 'you may need to establish a

book2.xls
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
Application.ActiveDocument.Content.PasteSpecial Link:=True,
DataType:=wdPasteOLEObject
exapp.ActiveWorkbook.Saved = True
exapp.Quit
Set exapp = Nothing
End Sub
3. You may try to open the excel application and then open the workbook

by
automation, and then call the macro that will retrieve data from DDE.
e.g. exapp.Run "a.xls!testmacro" ' the testmacro is one module macro

in
the a.xls file.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Word Document that shows Excel Chart

Hi,

I am glad I can help you. :)

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "hmmm..."
Newsgroups:

microsoft.public.word.oleinterop,microsoft.public. word.vba.general,microsoft
.public.word.word97vba,microsoft.public.excel.char ting,microsoft.public.exce
l.misc,microsoft.public.excel.programming
References: et


. net

et

. net

Subject: Word Document that shows Excel Chart
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4922.1500
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800
Message-ID: et
Date: Thu, 28 Aug 2003 23:05:08 GMT
NNTP-Posting-Host: 216.244.32.252
X-Complaints-To:
X-Trace: newsread3.news.pas.earthlink.net 1062111908 216.244.32.252 (Thu,

28 Aug 2003 16:05:08 PDT)
NNTP-Posting-Date: Thu, 28 Aug 2003 16:05:08 PDT
Organization: EarthLink Inc. --
http://www.EarthLink.net
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!newsfeed.icl.net!newsfeed.fjserv.net!colt.net !nycmny1-snf1.gtei.net!nyc
mny1-snh1.gtei.net!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.co
m!easynews.com!easynews!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas
.earthlink.net!newsread3.news.pas.earthlink.net.PO STED!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.word.vba.general:41495

microsoft.public.word.word97vba:68376 microsoft.public.excel.charting:33099
microsoft.public.excel.misc:268366
microsoft.public.excel.programming:411064
microsoft.public.word.oleinterop:8629
X-Tomcat-NG: microsoft.public.excel.programming

Hi Peter,

xyzCreate is part of xyz Addin. I finally got this to work!

Here's what I had to do in my Word macro to get the add-in loaded in Excel:

With exapp
.Workbooks.Add
.AddIns("xyz").Installed = False
.AddIns.Add "c:\win32app\xyz\api\dde\xyz.xla", False
.AddIns("xyz").Installed = True
.Workbooks.Close
End With

After that, the Excel workbook started up everything perfectly, and my

chart
was updated. Then I copied the chart from Excel and pasted into Word.

Thanks for all your advice!


"Peter Huang [MSFT]" wrote in message
...
Hi,

Where was the Macro "xyzCreate" located in? I have made a test that
automation a excel from work, I can not reproduce the problem you
encounter. Here is my test code.
[Word Macro]
Sub test()
Dim exapp As Excel.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book1.xls"
exapp.Visible = True
End Sub

[Excel Macro,book1.xls]
Sub testex()
MsgBox "hello"
End Sub

Private Sub Workbook_Open()
Range("a1").Select
Selection.Application.Run "testex"
End Sub

You may have a try and let me the result.

Also, when you excel application run, the addin or library needed to run
your macro is loaded aumatically, i.e if you start up the excel
application, the addin or library has been loaded?


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no

rights.
--------------------





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
excel 2007 chart in word document kdilly Excel Discussion (Misc queries) 0 February 2nd 10 08:34 PM
How to insert a word document onto an Excel Chart rb22 Excel Discussion (Misc queries) 1 June 16th 09 06:04 PM
EXCEL chart into Word document Perplexed Excel Discussion (Misc queries) 0 December 9th 07 09:51 PM
Copying excel chart to word document without gridlines Rudy Charts and Charting in Excel 1 May 31st 07 04:07 AM
Copying an Excel chart into a Word document Carolyn Excel Discussion (Misc queries) 7 July 11th 05 07:29 PM


All times are GMT +1. The time now is 12:47 PM.

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

About Us

"It's about Microsoft Excel"