Jump to content
Sign in to follow this  
Inverti

How to save specific Excel sheet to html

Recommended Posts

Inverti

Currently I use:
 
_Excel_BookSaveAs($oWorkbook, $sWorkbook, $xlHtml, True)
 
to save the Excel workbook to html and it works great.
 
Now, I want to save to html only specific sheet in workbook, or specific Pivot table on this sheet. It is achievable by "Save As" dialog, there I can choose the range, but I don't know how to automate it by AutoIT or VBA.
 
Could you please give me a clue how to do it?

Share this post


Link to post
Share on other sites
water

Which version of Excel do you run? I tried the SaveAs dialog with Excel 2010 but couldn't find a way to specify the range to be saved.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Inverti

I use Excel 2013, but as far as I remember the option was available in 2010, maybe even in 2007.

When I choose "Save As" and choose the .html file format ("Strona sieci Web" in Polish) additional options are shown at the bottom of the dialog:

post-65285-0-87005300-1410553497_thumb.p

Share this post


Link to post
Share on other sites
water

I started the macro recorder in Excel and did a SaveAs to HTML.

This is what I got:

ActiveWorkbook.PublishObjects.Add

The PublishObjects method is what you are looking for.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

_ExcelConstants.au3 contains just those constants used by any of the Excel functions in the UDF.

To not bload the constants file I suggest you add those constants to your script where needed.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
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  

×