Jump to content
Sign in to follow this  
NewtonScripter

code randomly not working correctly

Recommended Posts

NewtonScripter

I am trying to use ExcelCOM_UDF to automatically copy and paste from one workbook to another workbook.

But I am having a problem in which it randomly stops running and i get this error:

COM Error with DOM!

err.description is: Unable to get the Paste property of the Worksheet class

...(some other stuff)

Like it is just repeating the same thing over and over again

I do not understand why it isn't working that time.

I need the code to be reliable... without me checking up on it

so I can't have this happening randomly

It baffles me even more because I run the script again and it doesn't happen,

OR

I run it again and it happens on a different workbook pair...

What's even more weird is that this happens like after the first time Copy and Pasting, so you know the code works...

and then when I click okay, for the next worksheet pairs it still works...

This isn't the first time it happened to me though.

I remember I tried entering a filepath in the browse window, and once in a while it will say it can not find the file even though the whole path is written there...

I needed the code to be reliable so I ended up taking that part out.

Has anyone else run into these kinds of problems?

Is there any suggestions to work around it?

I'm thinking as hack to just repeat the copy and paste if the error window pops up.

Share this post


Link to post
Share on other sites
bogQ

I am trying to use ExcelCOM_UDF to automatically copy and paste from one workbook to another workbook.

But I am having a problem in which it randomly stops running and i get this error:

Can you show your script and pls tell what version of excel do you use?

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
NewtonScripter

I just restarted my computer and when it finished rebooting, i got a window saying something about "COM Surrogate".

What is COM Surrogate?

Can you show your script and pls tell what version of excel do you use?

My code is long, but for the part where I copy and paste:

$avJMReportUsedRange = _ExcelSheetUsedRangeGet($oJMReport, $sSheetName)


; copy and paste from JMReport to WFReport
$sRangeOrRow = "A1:B" & $avJMReportUsedRange[3]
_ExcelCopy($oJMReport, $sRangeOrRow)
$sRangeOrRow = "B1"
_ExcelPaste($oExcel, $sRangeOrRow)

The version of Excel I am using is 2003

Share this post


Link to post
Share on other sites
bogQ

COM Surrogate is some common error under vista, maby thats the reason that your geting "COM Error with DOM!". you use excel2003 under vista?

i try 1h conastantly to copy from one doc to another and from another to the first with 65536 lines of data on first column, lastnight with no errors (on xp) and excel 2002.

Maby the best way to slove this is to make another script that will control the first script and that will check errors and handle them.

While 1

if WinExists("","COM Error with DOM!") then

WinActivate("","COM Error with DOM!")

Send("{ENTER}")

if WinExists("your win script name","") then

WinClose("your win script name","")

EndIf

ShellExecute to restart your script

EndIf

WEnd


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
NewtonScripter

COM Surrogate is some common error under vista, maby thats the reason that your geting "COM Error with DOM!". you use excel2003 under vista?

i try 1h conastantly to copy from one doc to another and from another to the first with 65536 lines of data on first column, lastnight with no errors (on xp) and excel 2002.

Maby the best way to slove this is to make another script that will control the first script and that will check errors and handle them.

While 1

if WinExists("","COM Error with DOM!") then

WinActivate("","COM Error with DOM!")

Send("{ENTER}")

if WinExists("your win script name","") then

WinClose("your win script name","")

EndIf

ShellExecute to restart your script

EndIf

WEnd

I'm not running it on xp or vista, I'm running it on win 2000 server

I was thinking of something like you have to handle the errors. But I would like it better if I didn't have to hack my code.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.