Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default Step through a Word macro called from Excel?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Step through a Word macro called from Excel?

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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ed" wrote in message ...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default Step through a Word macro called from Excel?

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

"Ron de Bruin" wrote in message
...
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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ed" wrote in message

...
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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Step through a Word macro called from Excel?

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
oApp.Activate
oApp.Visible = True


It will not walk through your Word template code
You must do that in Word VBA



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ed" wrote in message ...
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

"Ron de Bruin" wrote in message
...
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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ed" wrote in message

...
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








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default Step through a Word macro called from Excel?

Thank you. I'll work with this. I appreciate the help.

Ed

"Ron de Bruin" wrote in message
...
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
oApp.Activate
oApp.Visible = True


It will not walk through your Word template code
You must do that in Word VBA



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ed" wrote in message

...
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

"Ron de Bruin" wrote in message
...
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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ed" wrote in message

...
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










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
Need step by step to add invoice numbering to excel template rmt New Users to Excel 4 July 6th 08 11:45 PM
How to change the macro called by an add in from older excel? Ian Excel Discussion (Misc queries) 2 June 25th 08 10:53 PM
Excel 2000 Step By Step. What URL to use in Lesson 8? dougcsdp New Users to Excel 4 March 4th 08 05:07 AM
I need step by step instructions to create a macro for 10 imbedde. diana Excel Worksheet Functions 3 January 31st 05 01:56 AM
Called macro runs twice in excel 2002 Tom Ogilvy Excel Programming 1 September 10th 03 02:12 PM


All times are GMT +1. The time now is 01:41 AM.

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"