Jump to content

Excel_BookOpen doesn't work at all, even using the example.


Hyflex
 Share

Recommended Posts

Use _Excel_Open, _Excel_BookNew, _Excel-BooksSaveAs to create a new workbook and save it to your disk. Then use _Excel_BookOpen to open it again and see what happens.

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

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Developers

Show me the SciTE console output when you run it so I can tell you it is working properly

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Use _Excel_Open, _Excel_BookNew, _Excel-BooksSaveAs to create a new workbook and save it to your disk. Then use _Excel_BookOpen to open it again and see what happens.

Err, it doesn't even open excel: http://i.imgur.com/ew7SFB2.png (excel is not open at all,

Show me the SciTE console output when you run it so I can tell you it is working properly

Jos

Here we go: http://i.imgur.com/rtfSweZ.png

Link to comment
Share on other sites

This means that there was a running intance of Excel where _Excel_Open attached to. Does the task manager show a running Excel process before you start the script?

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

This means that there was a running intance of Excel where _Excel_Open attached to. Does the task manager show a running Excel process before you start the script?

Nope, there is no excel running and even after rebooting and trying still the same thing.

Link to comment
Share on other sites

Has there ever been a trial version of MS Office installed on this machine?

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

  • Developers

Err, it doesn't even open excel: http://i.imgur.com/ew7SFB2.png (excel is not open at all,

Here we go: http://i.imgur.com/rtfSweZ.png

ok, so you don't have the full scite4autoit3 installed and are running the x86 version of autoit3!

jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Ok you are now running autoit3wrapper, but thought you added the #autoit3wrapper statement to run the x64 version of autoit3?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Strange, you are still running the x86 version. Do you have an autoit3_x64.exe in the autoit program directory?

jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I'm not sure how you mean.

Ok, allow me to rephrase it. Run this script and post your results:
 

#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Create application object and open an example workbook
Local $sWorkbook = @ScriptDir & "\Extras\_Excel1.xls"
Local $oAppl = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookAttach Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook)
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookAttach Example", "Error opening workbook '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($oAppl)
    Exit
EndIf

 

Link to comment
Share on other sites

Strange, you are still running the x86 version. Do you have an autoit3_x64.exe in the autoit program directory?

jos

Yep, it's there, same date and time as AutoIt3.exe

Reinstalling Autoit and switching default to x64 still gives me the same error but atleast it runs with x64.

Ok, allow me to rephrase it. Run this script and post your results:
 

#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Create application object and open an example workbook
Local $sWorkbook = @ScriptDir & "\Extras\_Excel1.xls"
Local $oAppl = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookAttach Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook)
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookAttach Example", "Error opening workbook '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($oAppl)
    Exit
EndIf

 

Error 2: http://i.imgur.com/Uzd3KLy.png (Same error with and without the double slash for C:\\Extras, same error also if I try in other folder locations)

Link to comment
Share on other sites

you didn't modify the code did you before you ran it? You need to run it EXACTLY as written when I posted it. I see you point the path to the root of C in the screenshot. That will cause a failure. 

I ran it exactly how you posted AND also ran it slightly modified by removing 1 slash because I tried it in C:/ as well.

Link to comment
Share on other sites

If you're running the code as posted by Bert, it won't work for you unless you have an excel file called _Excel1.xls in a folder called Extras under whatever folder you're running the script from. That script came from the help file example and that example script assumes that the scriptdir is in the AutoIt3 folder, which is located at AutoIt3\Examples\Helpfile, because that is where the help file example scripts are stored by default.

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

If you're running the code as posted by Bert, it won't work for you unless you have an excel file called _Excel1.xls in a folder called Extras under whatever folder you're running the script from. That script came from the help file example and that example script assumes that the scriptdir is in the AutoIt3 folder, which is located at AutoIt3\Examples\Helpfile, because that is where the help file example scripts are stored by default.

 

I had already made a folder in C:/Extras and created the excel file in there, however I also just tried it in the autoit example helpfile folder but it still didn't work.

Link to comment
Share on other sites

When you run this script from SciTE, if you look in the output panel in Scite, what is the name of the AutoIt3 exe file being run? If it's not AutoIt3_x64.exe then you're running the x86 version of AutoIt and that probably won't work to run the x64 version of Excel.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

When you run this script from SciTE, if you look in the output panel in Scite, what is the name of the AutoIt3 exe file being run? If it's not AutoIt3_x64.exe then you're running the x86 version of AutoIt and that probably won't work to run the x64 version of Excel.

It's the x64 version, i changed it before by reinstalling autoit and choosing x64

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...