Jump to content

open excel file


Recommended Posts

Hi I'm a php programmer first time playng with autoit , I think it's coll but I've some problem trying to strat an excel file with a macro insed

I've customized the one in the help file buit it doens't work , the ese I creted is in the same dir of excel file ... any help

thanx in advance

this is the code ,

$file = FileOpen("events.xls", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileClose($file)
Link to comment
Share on other sites

  • Developers

Hi I'm a php programmer first time playng with autoit , I think it's coll but I've some problem trying to strat an excel file with a macro insed

I've customized the one in the help file buit it doens't work , the ese I creted is in the same dir of excel file ... any help

thanx in advance

this is the code ,

$file = FileOpen("events.xls", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileClose($file)
Think you want to open the file with Excel .... right ?

try running the file with start or run Excel.exe ....

Edited by JdeB

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

yeah, to add to what jdeb said, FileOpen is just for opening text files for AutoIt to proccess...

run("c:\prg files\office\excel.exe c:\mydocs\file.xls") should open the file...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

ciao JdeB and thanx for your fast answer

yes I like to run the events.xls file but the macro I created in it run it in hide way and create a csv in a different directory , is it possible use this snippet to run excel file as the txt file in the example

Link to comment
Share on other sites

  • Developers

ciao JdeB and thanx for your fast answer

yes I like to run the events.xls file but the macro I created in it run it in hide way and create a csv in a different directory , is it possible use this snippet to run excel file as the txt file in the example

prego...

but i am somewhat puzzled what it is you want to accomplish here.

could you explain again which steps you want to do in the script ?

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

very easy I created a macro in vb insiede an excel file it does a webquery and save in a different directory a csv file well my macro end s here all the job its done in hidden window command

now with autoit I like to do an exe that call this macro inside result.xls file that's all

I used the cose snippet openfile function but it doesn't work

Link to comment
Share on other sites

  • Developers

when you run excel like emmanuel suggest, won't that work ?

In other words, does your macro automatically start up when events.xls is openend, and close the Excel file when finished ?

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

can you show the code that failed?

these failures are most often caused by syntax problems...

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

This might help, I bet the Run command isn't liking the spaces, so we use some creative double quotes

run('"C:\Programmi\Microsoft Office\OFFICE11\EXCEL.EXE" "C:\Programmi\Q2 Tuner\data\results.xls"')
The single quotes on the outside make it all one run command for autoit to send, and the double quotes inside help windows figure out what you're doing...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

browse the scripts and scraps section, the autoit install includes an examples folder and the includes are good for more advanced examples...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Emmanuel.. your explanation of the use of  'quotes'  and  "double quotes" is the best I have seen to explain their use.  Now it all makes sense.. the light  :ph34r:  just came on.  Thanks.

glad to have helped!

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

HI guys I'm implementing another piece of code on my little utility

as I told u my prog create 2 csv file in a backup directory weel this task is ok now as I told , now I'm trying to implement a progress bar window that stops when the 2 file are created

this is my meta code

------------------------

$firstcsv=namefirstcsv.csv

$secondcsv=namesecondcsv.csv

while // loop

($firstcsv !=0 $seconcsv !=0) {

ProgressOn("my progress window", "creating csv files ", "0 percent")

ProgressOff()}

-----------------------

any suggestion on how to do it in autoit coding syntax?

TIA

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