Word - 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
Word
(1)
VBA
(1)
DocumentType
(1)
NewTemplate
(1)
Phenomena
(1)
Showedall
(1)
VBE
(1)
  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
  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
  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
Create New Account
help
Creating a new document in VBA Word I'm trying to create a new Word document using VBA from Access and am having problems when I go to save the document. An error open (to save). Here is the way the code begins (after setting a reference to Word): Set wrdApp = New Word.Application Documents.Add DocumentType: = wdNewBlankDocument Selection.TypeParagraph Selection.TypeParagraph Selection.TypeText Text: = "Typing here for the body of the this "Save" process, that's when the error occurs. Any suggestions? Thanks in advance. - - Glenn Word VBA Discussions WrdApp (1) WdNewBlankDocument (1) DocumentType (1) DocCreate (1) StrTempFile (1) InsertParagraphAfter (1) ActiveDocument
Creating a document in VBA Word I'm trying to create a new Word document using VBA from Access and am having problems when I go to save the document. An error open (to save). Here is the way the code begins (after setting a reference to Word): Set wrdApp = New Word.Application Documents.Add DocumentType: = wdNewBlankDocument Selection.TypeParagraph Selection.TypeParagraph Selection.TypeText Text: = "Typing here for the body of the this "Save" process, that's when the error occurs. Any suggestions? Thanks in advance. - - Glenn Word VBA Beginners Discussions XP (1) WrdApp (1) WdNewBlankDocument (1) YourText (1) WrdDoc (1) SaveNativePictureFormat (1
Dateien_nach_Kundennummer_zerpfl ücken Word Word-Version XP Hallo zusammen, ich habe nachfolgendes Makro einmal aufgezeichnet, damit klar wird, was ich machen will. Ich habe eine Word-Datei, in der die Rechnungen von Kunden alle untereinander stehen. Nun soll jeweils eine Rechnung Delete Unit: = wdCharacter, Count: = 1 Selection.HomeKey Unit: = wdStory, Extend: = wdExtend Selection.Cut Documents.Add DocumentType: = wdNewBlankDocument Selection.PasteAndFormat (wdPasteDefault) Selection.HomeKey Unit: = wdStory Selection.EndKey Unit: = wdLine, Extend: = wdExtend Selection Delete Unit: = wdCharacter, Count: = 1 Selection.HomeKey Unit: = wdStory, Extend: = wdExtend Selection.Cut Documents.Add DocumentType: = wdNewBlankDocument Selection.PasteAndFormat (wdPasteDefault) Word VBA - German Discussions Windows XP (1) Office XP (1) Normal.NewMacros.Makro (1) SaveAsAOCELetter (1) Microsoft Word (1) Selection.PasteAndFormat (1) Hallo Oliver, en = 20 Bekommt bei Euch jeder Kunde nur eine
Word 2007 - DateiNeu-Dialog per vba Word hallo, ich m = F6chte per makro den dialog anzeigen, der im office-men = FC bei methode nicht) ab. kann mir jemand weiterhelfen? danke f = FCr eure unterst = FCtzung! vg inge Word VBA - German Discussions Microsoft Word (1) Windows Vista (1) Office 2007 (1) Word 2007 (1) Dialogs (1) Office (1) Error (1) StatusBar (1) Hallo inge Ha, jetzt sehe Frage von Eric March von heute) Sub Demo() Dim i As Long Dim dlg As Word.Dialog Dim doc As Word.Document Dim strText As String For i = 1 To 5000
Select Multiple pages from a Word document . . . Word Hello All, I am facing difficulty in copying a range of pages from an MS word document. Say, I have a document comprising of 50 pages and I want to select the first 20(1 to 20 pages) from the word document using VBA in MSExcel. Can someone pls help me out in resolving the same. P.S: I am using Office 2000 as my development environment. Regards, Gopi Word VBA Discussions Office 2003 (1) Office (1 Word (1) WdActiveEndPageNumber (1) VBA (1) XP (1) Word.Document (1) WdNewBlankDocument (1) I don't