Word
(1)
VBA
(1)
DocumentType
(1)
NewTemplate
(1)
Phenomena
(1)
Showedall
(1)
VBE
(1)

Debugging Problem In VBE

Asked By Harry-Wishes
21-Nov-09 02:22 PM
Hello,

I have come across a strange phenomena as I am stepping through my code with
the F8 key in the VBA editor.  There is a certain point in my subroutine
where the rest of the code self-executes to completion.  I will explain more.

When I reach the command (shown below) which happens to create a new
document from a template, it executes fine.  However, after this command
executes, the VBA editor takes control of my debugging and executes the rest
of my subroutine as though the entire macro had been executed at runtime.
Obviously, this prevents me from stepping through my code after this point in
the program.  Can someone offer me a suggestion or explain what could be the
trouble? Again my script is below.

Thanks

Harry Wishes

Documents.Add Template:= _
Data\Microsoft\Templates\Word_HTML.dot" _
, NewTemplate:=True, DocumentType:=0

I am not saying that it will help sort out the problem, but if you showedall

Doug Robbins - Word MVP replied to Harry-Wishes
21-Nov-09 04:37 PM
I am not saying that it will help sort out the problem, but if you showed
all of the code it might.

Is there any code in the template Word_HTML.dot?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ah Ha!

Harry-Wishes replied to Doug Robbins - Word MVP
21-Nov-09 06:15 PM
Ah Ha!

You just clued me in on something.  Indeed there is code in the
Word_HTML.dot. I commented out the code inside the template and lo and
behold, that solved the issue.  I will can now test to see which subroutine is
causing the self-execution.

Thanks for you help.

Harry-Wishes

What often causes this is code that operates on the VBA project itself.

Tony Jollans replied to Harry-Wishes
23-Nov-09 01:50 PM
What often causes this is code that operates on the VBA project itself.

--
Enjoy,
Tony

www.WordArticles.com
Post Question To EggHeadCafe