Jump to content
Sign in to follow this  
hg2052

Autoit:Write in a new sheet of an opened but not saved Excel workbook

Recommended Posts

hg2052

I have an .au3 script that retrieves data from web pages and writes them in an EXcel workbook that it opens.

Hao can I make it write data from each web page in another sheet of the same workbook, without first saving the workbook and then reopening it?

Share this post


Link to post
Share on other sites
MuchTex

I believe what you're asking for is _ExcelSheetAddNew(). After opening up a workbook you can simply use this function to open up a new sheet and begin writing data to it.

Edit- I don't have access to test it right now, but you might have to use _ExcelSheetActivate() before you begin writing data to it, although I highly doubt this is necessary.

Edited by MuchTex

Share this post


Link to post
Share on other sites
water

You have to use _ExcelSheetActivate because all other functions just write to the active WorkSheet.

This will change with my ExcelEX UDF - but this is still in a very early Alpha state.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
hg2052

MuchTex,

_ExcelSheetAddNew() needs 2 arguments. I cannot retrieve the second from a workbook on the desktop,where I did already fill Sheet1.

Share this post


Link to post
Share on other sites
water

Does the workbook you talk about already have all needed worksheets or do you need to add new worksheets to the workbook?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
hg2052

Water,

It has the sheets, as always when you launch Excel.exe : Book1 -> Sheet1,Sheet2,Sheet3...etc

Share this post


Link to post
Share on other sites
water

MuchTex,

_ExcelSheetAddNew() needs 2 arguments. I cannot retrieve the second from a workbook on the desktop,where I did already fill Sheet1.

The second parameter is the name of the new sheet and is optional. If you don't know the name simply let Excel select a name.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
water

Ok, lets stick with your on this subject where you hve already posted some code we can work on.

BTW: You know that the Mods don't like to see multiple threads on the same subject?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
hg2052

Water,

2.Mods...I know.

But it's about 2 subjects in the same script.

1.In my script, when I tried to "let Excel choose",I got the error message saying it needed 2 parameters.

Share this post


Link to post
Share on other sites
water

Can you please post the code you used. Parameter 2 of _ExcelSheetAddNew is definitely optional.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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  

×