Jump to content
Sign in to follow this  
theAutoitSpammer

_ExcelBookAttach() not working for me [SOLVED]

Recommended Posts

theAutoitSpammer

after reading and trying all suggestions I still can't make this function to work

if the workbook is already open.

is this a bug or a misuse or am i missing something?

here is the simple script I'm trying to run:

(the msgboxes are just for trouble shooting)

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

#Include <Excel.au3>

Opt("WinTitleMatchMode", 1)

$title = WinGetTitle('Microsoft Excel')

MsgBox(0,"",$Title)

$oExcel = _ExcelBookAttach($title, 'Title')

MsgBox(0,"",@error) ;----------------------------returns an error (error=1)

$dTitle = _ExcelReadCell($oExcel, 1, 1)

MsgBox(0,"",$dTitle)

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

help please ^_^

Edited by alram

Share this post


Link to post
Share on other sites
ResNullius

@alram

I suspect you're not getting an Excel COM instance created.

Which version of Excel is installed? Or is it Open Office or just the Excel Viewer?

Can you use any of the other Excel.au3 functions successfully?

What does the message box show with this?

#Include <Excel.au3>
Opt("WinTitleMatchMode", 1)

$title = WinGetTitle('Microsoft Excel')
;MsgBox(0,"",$Title)
$oExcel = _ExcelBookAttach($title, 'Title')
$err = @error
MsgBox(0,"Well","IsObj($oExcel): " & IsObj($oExcel) & @CRLF & "@error: " & $err)
$dTitle = _ExcelReadCell($oExcel, 1, 1)
;MsgBox(0,"",$dTitle)
Edited by ResNullius

Share this post


Link to post
Share on other sites
theAutoitSpammer

excel 2003 sp3

all other functions work

this will work if i open or create a new book just before _ExcelBookAttach(), but not if

the book is already open

IsObj($oExcel):0

@error:1

i hope this tells you something......thanks for your help

@alram

I suspect you're not getting an Excel COM instance created.

Which version of Excel is installed? Or is it Open Office or just the Excel Viewer?

Can you use any of the other Excel.au3 functions successfully?

What does the message box show with this?

#Include <Excel.au3>
Opt("WinTitleMatchMode", 1)

$title = WinGetTitle('Microsoft Excel')
;MsgBox(0,"",$Title)
$oExcel = _ExcelBookAttach($title, 'Title')
$err = @error
MsgBox(0,"Well","IsObj($oExcel): " & IsObj($oExcel) & @CRLF & "@error: " & $err)
$dTitle = _ExcelReadCell($oExcel, 1, 1)
;MsgBox(0,"",$dTitle)

Share this post


Link to post
Share on other sites
ResNullius

excel 2003 sp3

all other functions work

this will work if i open or create a new book just before _ExcelBookAttach(), but not if

the book is already open

IsObj($oExcel):0

@error:1

i hope this tells you something......thanks for your help

Well, I'm also using Excel 2003 w/ SP3.

And, like Jos, your script works perfectly for me:

I manually create a new Excel file or open an existing one, run your script and it works as expected.

If the other Excel.au3 functions are working for you, I don't really know what else to tell you ^_^

Share this post


Link to post
Share on other sites
theAutoitSpammer

i try in another 2 computers and worked!!!

so now I'm thinking...excel settings or windows settings or

registry error or missing services or........................

I'm going nuts ^_^

thanks any way for your help , I'll post if I find the solution and if

you can think in something let me know it will be much appreciated.

Well, I'm also using Excel 2003 w/ SP3.

And, like Jos, your script works perfectly for me:

I manually create a new Excel file or open an existing one, run your script and it works as expected.

If the other Excel.au3 functions are working for you, I don't really know what else to tell you ;)

Edited by alram

Share this post


Link to post
Share on other sites
theAutoitSpammer

A REGISTRY CLEANING DID THE TRICK ^_^

Share this post


Link to post
Share on other sites
ResNullius

A REGISTRY CLEANING DID THE TRICK ^_^

Good to hear you got it working.

But just a note: if you used a "registry cleaner" to do the job, you may have some other problems in future: they are notorious for stripping out empty entries that Microsoft somehow relies on when installing Office updates/Service packs!

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.