Jump to content

Upgraded Excel - now none of my scripts work


lilaray7581
 Share

Recommended Posts

I have upgraded my MS Office 2010 to MS Office 2016 and now none of my scripts work as they should. The first process is to open the Excel sheet and I can see that it opens it but it appears to be hidden. This never happened in the previous version of Office. I had changed it from the worksheet being on the network to locally as I thought that perhaps it was a network issue but it does the same thing when the file is located on the desktop or on the network. 

Local $oExcel = _Excel_Open()
            If @error Then Exit _Metro_MsgBox(64, "File Label", "Error creating the Excel application object." _
                     & @CRLF & "Need Excel on this computer. " _
                     & @CRLF & "Please contact Support for assistance. ", 400, 11, $Form1)
            _GUIDisable($Form1, 0, 30)
            Local $sWorkbook = "C:\Users\asmith\Desktop\DataSheet.xlsx"
            Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)
            $oWorkbook.sheets("File Label_Network Data").Select
            If @error Then Exit _Metro_MsgBox($MB_SYSTEMMODAL, "File Label_Network", "Error opening '" & $sWorkbook & "'." _
                     & @CRLF & "Missing the necessary documents to run this application. " _
                     & @CRLF & "Please contactfor assistance. ", 400, 11, $Form1)

 

Link to comment
Share on other sites

Did you upgrade AutoIt as well?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If you upgraded from a version < 3.3.12.0 then the Excel UDF has been rewritten.
Here you see what has changed: https://www.autoitscript.com/autoit3/docs/script_breaking_changes_excel_udf.htm

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Does the workbook get displayed when you open it by hand?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I think you should replace Select with Activate:

Local $oExcel = _Excel_Open()
If @error Then Exit _Metro_MsgBox(64, "File Label", "Error creating the Excel application object." _
    & @CRLF & "Need Excel on this computer. " _
    & @CRLF & "Please contact Support for assistance. ", 400, 11, $Form1)
_GUIDisable($Form1, 0, 30)
Local $sWorkbook = "C:\Users\asmith\Desktop\DataSheet.xlsx"
Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)
If @error Then Exit _Metro_MsgBox($MB_SYSTEMMODAL, "File Label_Network", "Error opening '" & $sWorkbook & "'." _
    & @CRLF & "Missing the necessary documents to run this application. " _
    & @CRLF & "Please contactfor assistance. ", 400, 11, $Form1)
$oWorkbook.sheets("File Label_Network Data").Activate

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I don't know why - or even how - but I went back and wrote one line off and compiled. It errored out and placed the line back and compiled. And it is now working. Perhaps it just wanted a jumpstart. Thanks for your assistance. What would activate do differently than select, if you don't mind me asking?

 

Link to comment
Share on other sites

When you have used activate this sheet becomes the active sheet and can be accessed by property ActiveSheet.
Select just selects the sheet but does not change the active sheet.
That's how I understand it.
Details can be found here: https://stackoverflow.com/questions/15919455/what-is-the-difference-between-sheets-select-and-sheets-activate

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...