Runtime Error 462: server not available 
Author Message
 Runtime Error 462: server not available

I am having a problem with a VB6 module I have as part of a windows
program.  In this program I have the requirement to open templates, fill
in the data that the user has placed into a database through the gui
screens and then show it to them in read-only, uneditable mode.  I have
implemented all this so it works... but only the first time.  Once I
close everything and set all the objects to nothing, I go back to the
gui screens.  Everything is great to this point.  However, when I try to
do it a second time, I get an error.  Stepping through the code it
occurs after I have created my application object and when I try do add
a new document based on a template.  The error is:  "462  The remote
server machine does not exist or is unavailable."

Like I said, the Word application object is created fine and Word is
started.  Before I enter the procedure I checked the task list and no
processes were running.  There were no files that were left open, I
checked that, too.  Anyone have any ideas?

Dennis



Mon, 06 Jan 2003 03:00:00 GMT  
 Runtime Error 462: server not available



Quote:
> I am having a problem with a VB6 module I have as part of a windows
> program.  In this program I have the requirement to open templates, fill
> in the data that the user has placed into a database through the gui
> screens and then show it to them in read-only, uneditable mode.  I have
> implemented all this so it works... but only the first time.  Once I
> close everything and set all the objects to nothing, I go back to the
> gui screens.  Everything is great to this point.  However, when I try to
> do it a second time, I get an error.  Stepping through the code it
> occurs after I have created my application object and when I try do add
> a new document based on a template.  The error is:  "462  The remote
> server machine does not exist or is unavailable."

> Like I said, the Word application object is created fine and Word is
> started.  Before I enter the procedure I checked the task list and no
> processes were running.  There were no files that were left open, I
> checked that, too.  Anyone have any ideas?

> Dennis

You need to be more specific

Can you post a section of the code that is failing

Keith



Tue, 07 Jan 2003 03:00:00 GMT  
 Runtime Error 462: server not available

Attached is a copy of the code.  I left in the appropriate file operations.
If you have any other questions, let me know.  This one is driving me nuts.

One other thing.  Everything clears up once I exit the VB program.  It appears
that it is{*filter*} on to something and not letting everything be cleaned up.

Dennis

Quote:



> > I am having a problem with a VB6 module I have as part of a windows
> > program.  In this program I have the requirement to open templates, fill
> > in the data that the user has placed into a database through the gui
> > screens and then show it to them in read-only, uneditable mode.  I have
> > implemented all this so it works... but only the first time.  Once I
> > close everything and set all the objects to nothing, I go back to the
> > gui screens.  Everything is great to this point.  However, when I try to
> > do it a second time, I get an error.  Stepping through the code it
> > occurs after I have created my application object and when I try do add
> > a new document based on a template.  The error is:  "462  The remote
> > server machine does not exist or is unavailable."

> > Like I said, the Word application object is created fine and Word is
> > started.  Before I enter the procedure I checked the task list and no
> > processes were running.  There were no files that were left open, I
> > checked that, too.  Anyone have any ideas?

> > Dennis

> You need to be more specific

> Can you post a section of the code that is failing

> Keith

[ code.txt 2K ]
Public Sub Produce_Report_1(doc_name As String)
Dim tmp_name As String

    On Error GoTo error_listing
    ldoc_name = doc_name & "_s.doc"                       'Establish document name
    num_para_change = 0
    num_lines_left = 0
    template_file = dalrsroot + "templates\dalrs_reports_1.dot"               'Get template

    Rpt_Prog_Bar.Label1.Caption = "Creating Word Document..."         'Update
    Rpt_Prog_Bar.ProgressBar1.Value = 7.5                               'progress
    Rpt_Prog_Bar.Label1.Refresh                                         'bar form
    Set wda_dalrs = CreateObject("Word.Application")
    wda_dalrs.Application.Visible = False
    If wda_dalrs.Options.SavePropertiesPrompt = True Then               'turn off prompt
        wda_dalrs.Options.SavePropertiesPrompt = False                  'for saving docs
        prop_prompt = True
    End If
    wda_dalrs.Documents.Open FileName:=template_file, passwordtemplate:=template_password, Format:=wdOpenFormatDocument
    tmp_name = ActiveDocument.AttachedTemplate.FullName
    wda_dalrs.Documents.Add (tmp_name)
    wda_dalrs.ActiveDocument.Unprotect
    wda_dalrs.ActiveDocument.SaveAs FileName:=ldoc_name, fileformat:=wdFormatDocument, Password:=template_password
    Rpt_Prog_Bar.Label1.Caption = "Establishing document security..."
    Rpt_Prog_Bar.Label1.Refresh
    Word_Reports_Reference.Turn_Off_Commandbars                 'proc to turn off commandbars

        'Do all the filling of the data here

    wda_dalrs.Documents(ldoc_name).Protect wdAllowOnlyComments
    wda_dalrs.Documents(ldoc_name).SaveAs FileName:=ldoc_name, Password:=template_password
    wda_dalrs.Documents.Close
    Rpt_Prog_Bar.ProgressBar1.Value = 100
    Rpt_Prog_Bar.Label1.Caption = "Report Generation Complete"
    Rpt_Prog_Bar.Label1.Refresh
    SetAttr ldoc_name, vbReadOnly
    wda_dalrs.Documents.Open ldoc_name, passwordtemplate:=template_password, ReadOnly:=True, passworddocument:=template_password

    wda_dalrs.PrintPreview = True
    wda_dalrs.ActiveWindow.View.Zoom.Percentage = 125

    wda_dalrs.Application.Visible = True
    On Error GoTo application_closed

    Do While wda_dalrs.PrintPreview = True
        'wait until closed
    Loop
    GoTo application_open
application_closed:
    Set wda_dalrs = CreateObject("Word.Application")
application_open:
    On Error GoTo error_listing
    wda_dalrs.Application.Visible = False
    If prop_prompt = True Then
        wda_dalrs.Options.SavePropertiesPrompt = True
    End If

    Word_Reports_Reference.Turn_On_Commandbars          'proc to turn on commandbars
    wda_dalrs.Quit wdDoNotSaveChanges
    Set wdr_dalrs = Nothing
    Set wrd_range2 = Nothing
    Set wdd_dalrs = Nothing
    Set wda_dalrs = Nothing
    Exit Sub

error_listing:
    MsgBox Err.number & " " & Err.Description

End Sub



Tue, 07 Jan 2003 03:00:00 GMT  
 Runtime Error 462: server not available

Keith,

    I solved my problem.  The offending code was the line:

    tmp_name = ActiveDocument.AttachedTemplate.FullName

    Since I didn't reference the application object, this object was created without being attached to this application object and
when I closed the application object, it was left like a{*filter*} pointer.  The next time I went in, it tried to use this same object
reference and it had been left pointing to a non-existing item and gave the error.  I found the answer in a MS Knowledgebase
article.  The url is attached here for Word and there appears to be a similar one for Excel.

This is for Word Documents :
http://www.*-*-*.com/

This is for Excel Documents:
http://www.*-*-*.com/

Dennis


Quote:
> Attached is a copy of the code.  I left in the appropriate file operations.
> If you have any other questions, let me know.  This one is driving me nuts.

> One other thing.  Everything clears up once I exit the VB program.  It appears
> that it is{*filter*} on to something and not letting everything be cleaned up.

> Dennis




> > > I am having a problem with a VB6 module I have as part of a windows
> > > program.  In this program I have the requirement to open templates, fill
> > > in the data that the user has placed into a database through the gui
> > > screens and then show it to them in read-only, uneditable mode.  I have
> > > implemented all this so it works... but only the first time.  Once I
> > > close everything and set all the objects to nothing, I go back to the
> > > gui screens.  Everything is great to this point.  However, when I try to
> > > do it a second time, I get an error.  Stepping through the code it
> > > occurs after I have created my application object and when I try do add
> > > a new document based on a template.  The error is:  "462  The remote
> > > server machine does not exist or is unavailable."

> > > Like I said, the Word application object is created fine and Word is
> > > started.  Before I enter the procedure I checked the task list and no
> > > processes were running.  There were no files that were left open, I
> > > checked that, too.  Anyone have any ideas?

> > > Dennis

> > You need to be more specific

> > Can you post a section of the code that is failing

> > Keith

>   ------------------------------------------------------------------------
> Public Sub Produce_Report_1(doc_name As String)
> Dim tmp_name As String

>     On Error GoTo error_listing
>     ldoc_name = doc_name & "_s.doc"                     'Establish document name
>     num_para_change = 0
>     num_lines_left = 0
>     template_file = dalrsroot + "templates\dalrs_reports_1.dot"         'Get template

>     Rpt_Prog_Bar.Label1.Caption = "Creating Word Document..."           'Update
>     Rpt_Prog_Bar.ProgressBar1.Value = 7.5                               'progress
>     Rpt_Prog_Bar.Label1.Refresh                                         'bar form
>     Set wda_dalrs = CreateObject("Word.Application")
>     wda_dalrs.Application.Visible = False
>     If wda_dalrs.Options.SavePropertiesPrompt = True Then               'turn off prompt
>         wda_dalrs.Options.SavePropertiesPrompt = False                  'for saving docs
>         prop_prompt = True
>     End If
>     wda_dalrs.Documents.Open FileName:=template_file, passwordtemplate:=template_password, Format:=wdOpenFormatDocument
>     tmp_name = ActiveDocument.AttachedTemplate.FullName
>     wda_dalrs.Documents.Add (tmp_name)
>     wda_dalrs.ActiveDocument.Unprotect
>     wda_dalrs.ActiveDocument.SaveAs FileName:=ldoc_name, fileformat:=wdFormatDocument, Password:=template_password
>     Rpt_Prog_Bar.Label1.Caption = "Establishing document security..."
>     Rpt_Prog_Bar.Label1.Refresh
>     Word_Reports_Reference.Turn_Off_Commandbars                 'proc to turn off commandbars

>         'Do all the filling of the data here

>     wda_dalrs.Documents(ldoc_name).Protect wdAllowOnlyComments
>     wda_dalrs.Documents(ldoc_name).SaveAs FileName:=ldoc_name, Password:=template_password
>     wda_dalrs.Documents.Close
>     Rpt_Prog_Bar.ProgressBar1.Value = 100
>     Rpt_Prog_Bar.Label1.Caption = "Report Generation Complete"
>     Rpt_Prog_Bar.Label1.Refresh
>     SetAttr ldoc_name, vbReadOnly
>     wda_dalrs.Documents.Open ldoc_name, passwordtemplate:=template_password, ReadOnly:=True, passworddocument:=template_password

>     wda_dalrs.PrintPreview = True
>     wda_dalrs.ActiveWindow.View.Zoom.Percentage = 125

>     wda_dalrs.Application.Visible = True
>     On Error GoTo application_closed

>     Do While wda_dalrs.PrintPreview = True
>         'wait until closed
>     Loop
>     GoTo application_open
> application_closed:
>     Set wda_dalrs = CreateObject("Word.Application")
> application_open:
>     On Error GoTo error_listing
>     wda_dalrs.Application.Visible = False
>     If prop_prompt = True Then
>         wda_dalrs.Options.SavePropertiesPrompt = True
>     End If

>     Word_Reports_Reference.Turn_On_Commandbars          'proc to turn on commandbars
>     wda_dalrs.Quit wdDoNotSaveChanges
>     Set wdr_dalrs = Nothing
>     Set wrd_range2 = Nothing
>     Set wdd_dalrs = Nothing
>     Set wda_dalrs = Nothing
>     Exit Sub

> error_listing:
>     MsgBox Err.number & " " & Err.Description

> End Sub



Tue, 07 Jan 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. WithEvents and Run-time error 462: The remote server machine does not exists or is unavailable

2. Run-time error '462': The remote server machine does not exist or is unavailable

3. WithEvents and Run-time error 462: The remote server machine does not exists or is unavailable

4. Error 462: Remote server machine does not exist, etc when running distributed COM

5. The remote server machine does not exist or is unavailable (Error 462)

6. The remote server machine does not exist or is unavailable (Error 462)

7. Word runtime error 462

8. Runtime Error 462 Active-X-Exe

9. 462 The remote server machine does not exist

10. Code hanging when Object is available giving Err 462 Help

11. Error 462 when automating Word

12. Error 462 when connection to a database

 

 
Powered by phpBB® Forum Software