After pasting a Chart in Word, excel makes a "restart"

C

Carlo

Hi all

i have following code:
'----------------------------------------------------------
Dim WRDAPP As Word.Application
Dim WRDDOC As Word.Document

Set WRDAPP = CreateObject("Word.Application")
Set WRDDOC = WRDAPP.Documents.Open("C:\Test.doc")

WRDAPP.Visible = true
ActiveSheet.Shapes("chart1").Copy
WRDAPP.Selection.Paste
'----------------------------------------------------------

As soon as following line gets executed: "WRDAPP.Selection.Paste"
excel starts executing:
'----------------------------------------------------------
Private Sub Workbook_Open()
Form_Start.Show
End Sub
'----------------------------------------------------------

Why is this so? Does anyone has a clue?

Cheers Carlo
 
J

JNW

I don't know why that happens but you could insert a line to disable events
(application.enableevents = false) so that it won't go back the workbook_open
event. Just make sure to enable them again.
 
C

Carlo

Hi JNW

Thanks a lot, that did the job!

Still don't know why that happens.

Thanks again

Carlo
 

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