Sign in to follow this  
Followers 0
polps

Excel UDF issue with 3.3.12.0 - bug?

8 posts in this topic

#1 ·  Posted (edited)

Hello all,

I have installed the new release 3.3.12.0.

I read in the changelog that Excel UDF was re-written and I read more in the script breacking changes.

Wat about the old function _ExcelSheetActivate? I read that this function was renamed in _Excel_SheetActivate but I can't find it in the Help, and my script now detect an error (even changing the name of the function).

Can someone clarify me?

Thanks

Gianluca.

Edited by polps

Share this post


Link to post
Share on other sites



Sorry, that is a documentation bug. _Excel_SheetActivate was not renamed but removed.
Use

$oExcel.Sheets.Item(x).Activate ; x can be the number or name of the sheet to activate

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

Does it need to be Sheets.Item(x).Activate? I usually just do Sheets(x).Activate, like so, but am wondering now if it may cause unintended consequences:

$oApp = _Excel_Open()
$oWorkBook = _Excel_BookOpen($oApp, @DesktopDir & "\Test.xlsx")
Sleep(2000)
$oWorkBook.Sheets("Sheet410").Activate

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

There is no difference because "Item" is the default property of the Sheets collection.

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

#5 ·  Posted (edited)

Sorry if I bother you with my questions..

I'm re-writing my script in order to have 3.3.12.0 compatibility.

Before this code was ok

$oFileTdcShuntingXls = _ExcelBookOpen ( $FileTdcShuntingXls, 1 )
_ExcelSheetActivate ( $oFileTdcShuntingXls, "ShuntingRoutes" )
$xlLastCell = 11
$oFileTdcShuntingXls.ActiveCell.SpecialCells($xlLastCell).Activate

I re-wrote in this way, but it seems to me that it si not working... 

$oExcel = _Excel_Open()
$oFileTdcTrafficXls = _Excel_BookOpen ( $oExcel, $FileTdcTrafficXls )
$oFileTdcTrafficXls.Sheets.Item("TrafficRoutes").Activate ; "TrafficRoute" is the name of the sheet to activate
$xlLastCell = 11
$oFileTdcTrafficXls.ActiveCell.SpecialCells($xlLastCell).Activate

Thanks again.

Edited by polps

Share this post


Link to post
Share on other sites

Are you sure that ActiveSheet and ActiveCell are still needed?

The rewritten UDF no longer only works with the active sheet. You can now specify the sheet to work with.


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

Ok, I solved.

Thanks again.

Share this post


Link to post
Share on other sites
:)

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