ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Method ~ of Object ~ Failed. (https://www.excelbanter.com/excel-programming/274977-method-%7E-object-%7E-failed.html)

joan

Method ~ of Object ~ Failed.
 
Excel 97 is being called by a VB program. The behavior is
this:

Excel opens fine on it's own (from the desktop). But all
of a sudden, on the PC in question, any piece of 'code'
from VB (or event using VBA in MSWord or Access) crashes
with the Error above on the 2nd line of code below:
' Create new hidden instance of Excel.
Set xlApp = New Excel.Application

' Add new workbook to Workbooks collection.
Set wkbNewBook = xlApp.Workbooks.Add

I've read thru all the KB articles and none seem to apply.

The only way to restore the functionality on the PC is to
completely unInstall MSExcel, manually removing all the
files associated with it, and then reinstalling. After the
reinstall of MSExcel the programs all work fine. It
appears that some dll or file is corrupting?

I've tried first just making sure that the MDAC library
was correct, to avoid the uninstall process, and it was
the correct version of MDAC.

It's weird. We have dozens of PCs running the VB
application. And this situation has come up 3 times in the
past few weeks.

Anybody have a clue?

thanks
Joan

joan

Method ~ of Object ~ Failed.
 
kiat.
thanks for your reply, but theres nothing wrong with the
code. It's been running fine for 2 years, and it runs fine
again after MSExcel is re-installed. I'm sure there's a
dll or something that's getting installed on these PC's or
becoming corrupt, or something like that. I wonder if
anybody can pinpoint that for me?

thanks
joan


-----Original Message-----
I'm not at all sure if this will help, but instead of

New, have you tried
CreateObject? Do a xlApp.Quit before sei it to nothing.

"Joan" wrote in message
...
Excel 97 is being called by a VB program. The behavior

is
this:

Excel opens fine on it's own (from the desktop). But all
of a sudden, on the PC in question, any piece of 'code'
from VB (or event using VBA in MSWord or Access) crashes
with the Error above on the 2nd line of code below:
' Create new hidden instance of Excel.
Set xlApp = New Excel.Application

' Add new workbook to Workbooks collection.
Set wkbNewBook = xlApp.Workbooks.Add

I've read thru all the KB articles and none seem to

apply.

The only way to restore the functionality on the PC is

to
completely unInstall MSExcel, manually removing all the
files associated with it, and then reinstalling. After

the
reinstall of MSExcel the programs all work fine. It
appears that some dll or file is corrupting?

I've tried first just making sure that the MDAC library
was correct, to avoid the uninstall process, and it was
the correct version of MDAC.

It's weird. We have dozens of PCs running the VB
application. And this situation has come up 3 times in

the
past few weeks.

Anybody have a clue?

thanks
Joan



.


steve

Method ~ of Object ~ Failed.
 
Joan,

Maybe it's other code in the workbook that is causing a crash.
I have had to clean up a lot of old code because of crashes. Some of the
culprits a
Modules and macros with the same name.
Public variables and Dim variables are the same.
Using names as variables or module/macro names or defined names that
are reserved words in Excel
cells, range, sum, date, .....

Just a guess...
--
sb
"joan" wrote in message
...
kiat.
thanks for your reply, but theres nothing wrong with the
code. It's been running fine for 2 years, and it runs fine
again after MSExcel is re-installed. I'm sure there's a
dll or something that's getting installed on these PC's or
becoming corrupt, or something like that. I wonder if
anybody can pinpoint that for me?

thanks
joan


-----Original Message-----
I'm not at all sure if this will help, but instead of

New, have you tried
CreateObject? Do a xlApp.Quit before sei it to nothing.

"Joan" wrote in message
...
Excel 97 is being called by a VB program. The behavior

is
this:

Excel opens fine on it's own (from the desktop). But all
of a sudden, on the PC in question, any piece of 'code'
from VB (or event using VBA in MSWord or Access) crashes
with the Error above on the 2nd line of code below:
' Create new hidden instance of Excel.
Set xlApp = New Excel.Application

' Add new workbook to Workbooks collection.
Set wkbNewBook = xlApp.Workbooks.Add

I've read thru all the KB articles and none seem to

apply.

The only way to restore the functionality on the PC is

to
completely unInstall MSExcel, manually removing all the
files associated with it, and then reinstalling. After

the
reinstall of MSExcel the programs all work fine. It
appears that some dll or file is corrupting?

I've tried first just making sure that the MDAC library
was correct, to avoid the uninstall process, and it was
the correct version of MDAC.

It's weird. We have dozens of PCs running the VB
application. And this situation has come up 3 times in

the
past few weeks.

Anybody have a clue?

thanks
Joan



.




kiat

Method ~ of Object ~ Failed.
 
well, I have recently encountered a runtime error on the second line for
adding a document to an Autocad application after that was set with the New
keyword. It was also a VB program and was run OK and then for no apparent
reason would crash on the second line. after i changed it to CreateObject,
all is well.

i can't figure out why, it's so strange. so i can't be sure this will work
on your case. the MS documentation says that in both my cases, the app
object was early bind since i declared it so like you have, in my case Dim
oApp as acad.application. the documentation continues to say that New and
CreateObject are the same except that CreateObject is slower. so may be,
slower is safer?

reference
http://msdn.microsoft.com/library/de...us/office97/ht
ml/SF7A4.asp

"joan" wrote in message
...
kiat.
thanks for your reply, but theres nothing wrong with the
code. It's been running fine for 2 years, and it runs fine
again after MSExcel is re-installed. I'm sure there's a
dll or something that's getting installed on these PC's or
becoming corrupt, or something like that. I wonder if
anybody can pinpoint that for me?

thanks
joan


-----Original Message-----
I'm not at all sure if this will help, but instead of

New, have you tried
CreateObject? Do a xlApp.Quit before sei it to nothing.

"Joan" wrote in message
...
Excel 97 is being called by a VB program. The behavior

is
this:

Excel opens fine on it's own (from the desktop). But all
of a sudden, on the PC in question, any piece of 'code'
from VB (or event using VBA in MSWord or Access) crashes
with the Error above on the 2nd line of code below:
' Create new hidden instance of Excel.
Set xlApp = New Excel.Application

' Add new workbook to Workbooks collection.
Set wkbNewBook = xlApp.Workbooks.Add

I've read thru all the KB articles and none seem to

apply.

The only way to restore the functionality on the PC is

to
completely unInstall MSExcel, manually removing all the
files associated with it, and then reinstalling. After

the
reinstall of MSExcel the programs all work fine. It
appears that some dll or file is corrupting?

I've tried first just making sure that the MDAC library
was correct, to avoid the uninstall process, and it was
the correct version of MDAC.

It's weird. We have dozens of PCs running the VB
application. And this situation has come up 3 times in

the
past few weeks.

Anybody have a clue?

thanks
Joan



.




joan

Method ~ of Object ~ Failed.
 
The trick is that the app continues to run fine on the
other 40+ PCs. So it's gotta be some kind of dll conflict.
I will try using CreateObject instead of New on these
excel calls, just to see. That could related to a dll
version difference. I'll let you know.

thanks for your input
joan

-----Original Message-----
Joan,

Maybe it's other code in the workbook that is causing a

crash.
I have had to clean up a lot of old code because of

crashes. Some of the
culprits a
Modules and macros with the same name.
Public variables and Dim variables are the same.
Using names as variables or module/macro names or

defined names that
are reserved words in Excel
cells, range, sum, date, .....

Just a guess...
--
sb
"joan" wrote in message
...
kiat.
thanks for your reply, but theres nothing wrong with the
code. It's been running fine for 2 years, and it runs

fine
again after MSExcel is re-installed. I'm sure there's a
dll or something that's getting installed on these PC's

or
becoming corrupt, or something like that. I wonder if
anybody can pinpoint that for me?

thanks
joan


-----Original Message-----
I'm not at all sure if this will help, but instead of

New, have you tried
CreateObject? Do a xlApp.Quit before sei it to

nothing.

"Joan" wrote in message
...
Excel 97 is being called by a VB program. The

behavior
is
this:

Excel opens fine on it's own (from the desktop). But

all
of a sudden, on the PC in question, any piece

of 'code'
from VB (or event using VBA in MSWord or Access)

crashes
with the Error above on the 2nd line of code below:
' Create new hidden instance of Excel.
Set xlApp = New Excel.Application

' Add new workbook to Workbooks collection.
Set wkbNewBook = xlApp.Workbooks.Add

I've read thru all the KB articles and none seem to

apply.

The only way to restore the functionality on the PC

is
to
completely unInstall MSExcel, manually removing all

the
files associated with it, and then reinstalling.

After
the
reinstall of MSExcel the programs all work fine. It
appears that some dll or file is corrupting?

I've tried first just making sure that the MDAC

library
was correct, to avoid the uninstall process, and it

was
the correct version of MDAC.

It's weird. We have dozens of PCs running the VB
application. And this situation has come up 3 times

in
the
past few weeks.

Anybody have a clue?

thanks
Joan


.



.


joan

Method ~ of Object ~ Failed.
 
Kiat.
Well just for fine i tried changing the call to
CreateObject instaed of New. Still the same err:
Method~ofOBject~Failed.

....and the app with the code using 'New' is still running
fine on the other 40+ PCs.

...any other ideas? I appreciate your help

thanks
joan

-----Original Message-----
well, I have recently encountered a runtime error on the

second line for
adding a document to an Autocad application after that

was set with the New
keyword. It was also a VB program and was run OK and then

for no apparent
reason would crash on the second line. after i changed it

to CreateObject,
all is well.

i can't figure out why, it's so strange. so i can't be

sure this will work
on your case. the MS documentation says that in both my

cases, the app
object was early bind since i declared it so like you

have, in my case Dim
oApp as acad.application. the documentation continues to

say that New and
CreateObject are the same except that CreateObject is

slower. so may be,
slower is safer?

reference
http://msdn.microsoft.com/library/default.asp?

url=/library/en-us/office97/ht
ml/SF7A4.asp

"joan" wrote in message
...
kiat.
thanks for your reply, but theres nothing wrong with the
code. It's been running fine for 2 years, and it runs

fine
again after MSExcel is re-installed. I'm sure there's a
dll or something that's getting installed on these PC's

or
becoming corrupt, or something like that. I wonder if
anybody can pinpoint that for me?

thanks
joan


-----Original Message-----
I'm not at all sure if this will help, but instead of

New, have you tried
CreateObject? Do a xlApp.Quit before sei it to

nothing.

"Joan" wrote in message
...
Excel 97 is being called by a VB program. The

behavior
is
this:

Excel opens fine on it's own (from the desktop). But

all
of a sudden, on the PC in question, any piece

of 'code'
from VB (or event using VBA in MSWord or Access)

crashes
with the Error above on the 2nd line of code below:
' Create new hidden instance of Excel.
Set xlApp = New Excel.Application

' Add new workbook to Workbooks collection.
Set wkbNewBook = xlApp.Workbooks.Add

I've read thru all the KB articles and none seem to

apply.

The only way to restore the functionality on the PC

is
to
completely unInstall MSExcel, manually removing all

the
files associated with it, and then reinstalling.

After
the
reinstall of MSExcel the programs all work fine. It
appears that some dll or file is corrupting?

I've tried first just making sure that the MDAC

library
was correct, to avoid the uninstall process, and it

was
the correct version of MDAC.

It's weird. We have dozens of PCs running the VB
application. And this situation has come up 3 times

in
the
past few weeks.

Anybody have a clue?

thanks
Joan


.



.



All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com