Step through a Word macro called from Excel?

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

I have a Word 2000 template with an AutoNew macro. This is called by a
macro in Excel. I need to make some changes to the Word macro, but I can't
seem to figure out how to step through it to see what's happening. I can
step through the Excel macro, but when it hits
Set WD = CreateObject("Word.Application")
WD.Documents.Add
the Word document and actions are invisible, and I can't see the steps.

Any suggestions?

Ed
 
Try this

Sub test()
Dim oApp As Word.Application
On Error Resume Next
Set oApp = GetObject(, "Word.Application")
If Err <> 0 Then
Set oApp = CreateObject("Word.Application")
End If

oApp.Activate
oApp.Visible = True
oApp.Documents.Add

'do things

'oApp.ActiveDocument.Close wdDoNotSaveChanges
'oApp.Quit

Set oApp = Nothing
End Sub
 
Thanks, Ron - but I'm a bit lost in using this. Is this a separate Excel
Sub to allow me to walk through my template code? Or should I put this in
my existing Excel code?

Ed
 
The Excel sub open Word and make it visible and add a document for you
the Word document and actions are invisible

You can see your Word document now with
It will not walk through your Word template code
You must do that in Word VBA
 
Back
Top