Sign in to follow this  
Followers 0
ojef1

Excel Objects

10 posts in this topic

#1 ·  Posted (edited)

I've been looking through the help file and I see some of the examples using commands such as

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

[b]$iNumberOfWorksheets = $oExcel.Worksheets.Count[/b]

MsgBox(0, "", $oExcel.Worksheets.Count)
_ExcelSheetActivate($oExcel, 2)

Is there a list somewhere of all the Excel Object commands ($oExcel.-----.----)?

Edited by ojef1

Share this post


Link to post
Share on other sites



Hi ojef1,

you could take a look at VBA help, which gives you a good overview of the objects, methods and attributes Excel is working with.

Here's a link to the MSDN Excel VBA Language Reference: Link

It's a compiled help file. Browse and have fun!

:)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

For Excel 2007 the Object Model Reference can be found here.

For Excel 2010 the Object Model Reference can be found here.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks those should help a lot. Is it not possible to open up and reference two separate excel objects without switching between the two?

Share this post


Link to post
Share on other sites

If you want to open two Excel worksheets at the same time - then it's possible.

Global $oExcelNew = _ExcelBookNew()
Global $oExcelExist = _ExcelBookOpen("C:\temp\test.xls")
$sCell = _ExeclReadcell($oExcelExist, "A1")
_ExcelWriteCell($oExcelNew, $sCell, "A1")

Opens an existing and a new Excel workbook, takes cell 1 from the existing workbook and writes it to the new one.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

That's what I thought but the errors I was getting made me believe otherwise so I combined the two into the same spreadsheet on separate sheets...That wasn't the problem though. Unfortunately, it's hard to tell what the issue is now.

The reason I asked my original question is because (among other things) it would be really helpful to be able to search for a string (stored in a cell on spreadsheet A) on spreadsheet B without manually activating the window and using excels find function. Sort of like a VLookup but for excel objects

I was hoping to run all of the excel stuff in the background without having to constantly switch between windows.

Share this post


Link to post
Share on other sites

If you want to open two Excel worksheets at the same time - then it's possible.

Global $oExcelNew = _ExcelBookNew()
Global $oExcelExist = _ExcelBookOpen("C:\temp\test.xls")
$sCell = _ExeclReadcell($oExcelExist, "A1")
_ExcelWriteCell($oExcelNew, $sCell, "A1")

Opens an existing and a new Excel workbook, takes cell 1 from the existing workbook and writes it to the new one.

I've never tested it myself but I will have a look at it tomorrow and see what error messages I get.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

No I think you're right that should work fine...there's something wrong here I'll keep working at it though and report back if neccessary

thanks for the help

Share this post


Link to post
Share on other sites

I think you're mixing up two things.

One is the COM (Component Object Model) which is used by the UDF to access Excel and the other is the GUI you control using keyboard and mouse.

Everything you do with mouse and keyboard can be done with the UDF or directly in your script.

Have a look in the help file for the Excel UDF. If you don't find the functions you need then search the forum for ExcelCOM UDF. That's an expanded Excel UDF.

If you still didn't find what you need then please ask again :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I think you're mixing up two things.

One is the COM (Component Object Model) which is used by the UDF to access Excel and the other is the GUI you control using keyboard and mouse.

Everything you do with mouse and keyboard can be done with the UDF or directly in your script.

Have a look in the help file for the Excel UDF. If you don't find the functions you need then have a look a the That's an expanded Excel UDF.

If you still didn't find what you need then please ask again :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  
Followers 0