Error 462: The remote server machine does not exist or is unavailable.

A

Amod

hi

all

I am coding in Vb6.0 with the following code.I am getting
an error "Error 462: The remote server machine does not
exist or is unavailable." while automating Excel 2000
through Vb 6.0. The code is given below ....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim xlApp As Excel.Application
Dim xlWorkBook1 As New Excel.Workbook
Dim WithEvents eveXlWorkbook1 As Excel.Workbook
-----------------------------------------
Private Sub Command1_Click()
Set xlApp = CreateObject("Excel.application")
Set xlWorkBook1 = xlApp.Workbooks.Open("c:\book2.xls")
xlApp.EnableEvents = True

Set eveXlWorkbook1 = xlWorkBook1
xlApp.Visible = True
End Sub
------------------------------------------
Private Sub eveXlWorkbook1_BeforeClose(Cancel As Boolean)
xlApp.EnableEvents = False
Set xlWorkBook1 = Nothing
xlApp.Quit
Set xlApp = Nothing
End Sub
----------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

this is a standard exe project with a form conatains one
command button. When I click on the command button for the
first time it works nicely, when I click on the command
button second time I get the above error.

this error comes on the line "Set eveXlWorkbook1 =
xlWorkBook1" in "Command1_Click()" procedure. this error
comes because of "Unqualified Code for office object"

check this url
"http://support.microsoft.com/default.aspx?scid=kb;en-
us;319832"

Please suggest any changes to code so it will work.
I have tried with "Set eveXlWorkbook1 = xlapp.workbooks
(1)" and "Set eveXlWorkbook1 = xlapp.ActiveWorkbook"

waiting for reply
regards
Amod
 

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