Word 97 Windows 98 macro error

R

Roy

Hi All,
I am having problems with a macro. This is the lowdown.

I have a custom template with some macros in it. The template is
signed digitally (in word 2000). I run the macro in this template in a
windows 2000, word 97, IE 5.5 environment and I have no problems.

I get a "Compile error in hidden module: ThisDocument" when I try to
run the macro in a windows 98, word 97 and IE 6 environment.

Anyone have any ideas?

Thanks for your help,
Roy.
 
C

Charles Kenyon

Your code has one or more commands that won't compile with the Word 97 vba.
Since it is digitally signed, you won't be able to view the code in Word 97.
 
R

Roy

Charles -
Thanks for your reply. How do I find out which command
won't compile with Word 97 vba? I tried by adding a whole bunch of
msgboxes in the macro function (signing in 2000 and then trying in the
windows 98 workstation) that is causing this problem and I still get a
compile error.

Also, the modified macro works in the following environment:
Windows 2000 SP3, Word 97 and IE 5.5

This is what confuses me, the code works on word 97 vba (in windows
2000, IE 5.5 environment). It just doesn't work in Windows 98 IE 6
environment.

Thanks,
Roy.
 
R

Roy

Hi All,
By trial and error I figured out which statement was
causing the problem in Word 97. It was

Selection.NoProofing = False

Aparently this is not a valid statement in Word 97. I got around this
by calling separate methods based on the version of word.

From ThisDocument:
....
Dim wordVersion as String
wordVersion = Word.Application.Version
If (Mid(wordVersion, 1, 1)) = "9" Then
CheckSpelling9
Else
CheckSpelling8
End If
....

Methods in Class Module:
Private Sub CheckSpelling8()
Selection.LanguageID = wdEnglishUS
Selection.Range.CheckSpelling
End Sub

Private Sub CheckSpelling9()
Selection.NoProofing = False
Selection.LanguageID = wdEnglishUS
Selection.Range.CheckSpelling
End Sub

What is weird is that word 97 on windows 2000 seems to have no problem
with
Selection.NoProofing = False
Anyway I hope this helps anyone else who is having the same problem.

Thanks,
Roy.
 
C

Charles Kenyon

I suspect a different build of Word. There were a lot of fixes for Word 97.

Anyway, you can conditionally compile statements.

Here is the explanation I received from Jay Freedman a few years back:
Hi, Charles,

The syntax you need is

#If VBA6 Then
Dim vResult As VbMsgBoxResult
#Else
Dim vResult As Variant
#End If
 
Top