my Vb6 MS Word 2003 VBA code crashes VS

P

Pete

Hi - An earlier posting discussed this same result but I do not think I
have the same coding problems. In the following VB6 program the
"InsertBefore" works but then VS crashes when it tries to process the
first "Find" line. Help would sure be appreciated!

Dim wdApp As Word.Application
Dim wdDocs As Word.Documents
Dim wdDoc As Word.Document
Dim wdSel As Word.Selection
Set wdApp = New Word.Application
Set wdDocs = wdApp.Documents
Set wdDoc = wdApp.Documents.Add
wdDoc.Activate
wdDoc.Content.Text = "aba"
wdDoc.Content.Select
Set wdSel = wdApp.Selection
wdSel.InsertBefore "d"
wdApp.Visible = True
' either of the next two, by itself, crashes VS
wdSel.Find.ClearFormatting
wdSel.Find.Text = "b"
wdSel.Find.Execute
...
- Pete
 
P

Pete

Hi - I found the work-around for this bug: (1) use late binding; or (2)
re-register the Word 2003 Type Library msword.olb after any update to
Excel.

- Pete
 

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