Problems with Normal.dot when creating a Word document in VBA

Essendon

Registered User.
Local time
Today, 12:47
Joined
Oct 25, 2001
Messages
65
Hi,

I am attempting to create a word document from VBA code in Access. I am having a problem with Normal.doc when running my code. If I delete normal.dot my code works fine and the document is created ok the first time I run it. Every time after, I usually get a error stating "Normal.dot caused a serious error last time it was opened, do you want to continue opening it?" Other times, it will simply open word (with no document open). One other thing I've noticed is that sometimes when I try to close the document it will ask me if I want to save changes to normal.dot.

This is very frustrating considering I got the code straight from a book about Access.

Here is the code:

Dim objWord As Word.Application
Dim objTable As Word.Table

On Error Resume Next

'Use a running word instance if possible
Set objWord = GetObject(, Word.Application)

'Otherwise use a new instance
If objWord Is Nothing Then
Set objWord = New Word.Application
'If true, Word is not installed.
If objWord Is Nothing Then
MsgBox "Word is not installed on your system"
End If
End If

objWord.Documents.Add
objWord.Activate
objWord.Visible = True

objWord.Selection.TypeText Text:="203 Rose Avenue"

Set objWord = Nothing

Exit Sub

I have tried deleting normal.dot and also making it read only. I have also tried re-installing office. No luck there.
I have tried the code on two other machines. On one machine (Win XP Pro, Office XP Pro) it runs fine, but on another (Win XP Pro, Office XP Pro) it has the same troubles as the machine I am currently developing on (Win XP Home, Office XP Pro).

Someone please help!
 
Last edited:
Hi,

Havn't been on the forums in a while, so I just thought I would answer my own question in case anyone has this problem in the future.

The problem is caused by Norton Antivirus 2002 (and possibly other versions). To fix the problem, you have to disable the office plug-in within Norton.

Cheers,

Peter
 
As long as you open and close many times in your code object of type Word.Application the problem will continue to occur! Open and close once Word.Application and inside the block "With wordApp .... End With" you can open and close as many Word.Document obects you want without the anoying message of normal.dot!:)
 

Users who are viewing this thread

Back
Top Bottom