Question : Urgent - Creating Word document - Ok in NT, Error in 2000

Got a serious problem. Following code (hope I haven't left out anything relevant) works fine in R5/NT4.
People have introduced Win2000 PC's in production but our apps have never been tested for this OS (!). Apperently it doesn't run as expected, but generates an error. The solution is expected from a design change rather than changing the OS.
The code is supposed to generate and show a new word document. The original code wrote notes fields to it, save it and attach it in an e-mail, but I left those parts out.

Please confirm the error and advice for improvements to overcome the error while a Win2000 PC is prepared for me here. We're talking about an object var. not set in the first line of the "Show" sub.

Thanks!


Script Library "Word - Document":

Options:
Option Public
Option Declare

Declarations:
Class WordDocument
      Private word_application As Variant
      Private word_document As Variant
      
      Public Sub New
            Set Me.word_application = Nothing
            Set Me.word_document = Nothing
            On Error Resume Next
            Set Me.word_application = GetObject("", "Word.Application")
            If (Err = 208) Then
                  ' Word not active. Create new object to launch Word in background.
                  Err = 0
                  Set Me.word_application = CreateObject("Word.Application")
            End If
            Call Me.word_application.Documents.Add
            Set Me.word_document = Me.word_application.ActiveDocument
      End Sub
      
      Public Sub Delete
            Set Me.word_application = Nothing
            Set Me.word_document = Nothing
      End Sub
      
      Public Sub Show
            Me.word_application.Visible = True
            Me.word_application.WindowState = 1
      End Sub

%Rem
...Couple of other subs and functions...
%EndRem

End Class

- - - - - - - - - - - - - - - - - - - - - - - - - -

Action button:

Options:
Use "Word - Document"

Sub Click(Source As Button)
      Dim worddoc As WordDocument
      ' ...accessing notes docs etc...
      Set worddoc = New WordDocument
      worddoc.Show
      ' ...etc...
End Sub

Answer : Urgent - Creating Word document - Ok in NT, Error in 2000

Is word installed on this new OS ? If so uninstall and reinstall this might fix the problem

I see no problem except if the object is not registered properly in registry then you can't get handle to OLE object..

~Hemanth
Random Solutions  
 
programming4us programming4us