titi9030

Open excel

12 posts in this topic

HI to everybody

 

I am trying to open an excel file, but I can not figure out what is the correct syntaxis of it.. 

 

I have read it from the help part of autoi, but unfortunatelly I coud not find what's the correct way for doing it, I`d like to open a file that exist in my desktop

 

"#include <Excel.au3>
_Excel_BookOpen ( $oExcel, $sFilePath [, $bReadOnly = False [, $bVisible = True [, $sPassword = Default [, $sWritePassword = Default [, $bUpdateLinks = Default]]]]] )"

 

Thank you very much

Share this post


Link to post
Share on other sites



Just now, titi9030 said:

HI to everybody

 

I am trying to open an excel file, but I can not figure out what is the correct syntaxis of it.. 

 

I have read it from the help part of autoit, but unfortunatelly I coud not find what's the correct way for doing it, I`d like to open a file that exist in my desktop

 

"#include <Excel.au3>
_Excel_BookOpen ( $oExcel, $sFilePath [, $bReadOnly = False [, $bVisible = True [, $sPassword = Default [, $sWritePassword = Default [, $bUpdateLinks = Default]]]]] )"

 

Thank you very much

 

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum!

Did you have a look at the example scripts that come with the help file?
$sPath should be something like

@DesktopDir & "\Your_Filename.xlsx"

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
10 hours ago, water said:

Welcome to AutoIt and the forum!

Did you have a look at the example scripts that come with the help file?
$sPath should be something like

@DesktopDir & "\Your_Filename.xlsx"

 

I have tried with it, but it doesn't work either

 

Thanks for  your support, i really apreciate..

Share this post


Link to post
Share on other sites

Can you please post the exact code you used?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#include <Excel.au3>
@DesktopDir & "\hola.xlsx"

 

hola is the name of the file in my desktop

Share this post


Link to post
Share on other sites

OK, let's try this little script:

#include <Excel.au3>
Global $oExcel = _Excel_Open()
MsgBox(0, "", "Open: " & @error)
Global $sFilePath = @DesktopDir & "\hola.xlsx" 
_Excel_BookOpen($oExcel, $sFilePath)
MsgBox(0, "", "BookOpen: " & @error)

What do you get?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

it was exactly what I was expected, thank you very for your help and support...!!!!!

Share this post


Link to post
Share on other sites

Great.
What's the next step?
How do you want to process the Excel workbook?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

i want to open a website and look for some information I have read in workbook, the idea is to create cycle in order to copy from Excel and paste into the website..

the information would be in range "a1" into the workbook and once I have look it into the website I wanto copy the information I need in range "a2" then "a3", "a4" depens on what I am looking for... 

I am using autoit, coz it allow me to use the mouse to click into the website, it was not possible in visual basic for Excel..

What can you recommend me?

#include <IE.au3>

$sURL = "http://www.despegar.com.co/"
$oIE = _IECreate($sURL, 0, 0, 0)
$HWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($HWND, "", @SW_MAXIMIZE)
_IEAction($oIE, "visible")
_IELoadWait($oIE)
MouseClick($MOUSE_CLICK_PRIMARY, 85, 342, 2)

Share this post


Link to post
Share on other sites

To read data from Excel use function _Excel_RangeRead. Either cell by cell or the whole worksheet and then loop through the array.
I wouldn't use functions to automate the browser via GUI (WinSetState, MouseClick ...) because they are not very reliable. They depend on screen resolution and window position.
I suggest to use the IE* functions for everything.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks a lot dude, I would try it and let you know....

thanks for your comments...

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