Jump to content

Excel Macro


Recommended Posts

Hello everyone.

I am very new to AutoIt, infact this is my first post and I am only about an hour into the discovery of this seemly wonderful program.

To run a macro in excel open the .xls file, and then hold down (ctrl, shift, and i), but I would like to do this is AutoIt.

So far I am able to open the specific .xls file that I want.

I have tried the send() command, but it is not working send("^i")

Thank you in advance for your help, and I am very glad that I found this program, it is going to be extreamly useful!

Link to comment
Share on other sites

I have tried the send() command, but it is not working send("^i")

<{POST_SNAPBACK}>

You are only sending "Ctrl and i" and you say you need to send "ctrl, shift, and i"

Shouln't it be send("^+i") not send("^i")

Post your script to examine.

Edited by bshoenhair
Link to comment
Share on other sites

Run("C:\Program Files\Microsoft Office\Office\EXCEL.EXE C:\fedxrem\upseinv_analysis.xls")

Send("^+i")

This also does not work

<{POST_SNAPBACK}>

Need to use WinWait to allow time for workbook to load.

try

Run("C:\Program Files\Microsoft Office\Office\EXCEL.EXE C:\fedxrem\upseinv_analysis.xls")
WinWait("Microsoft Excel - upseinv_analysis.xls","");;YOU MIGHT NEED TO CHANGE TITLE IF IT DIFFERS
Send("^+i")
Link to comment
Share on other sites

I did not know that you could do that. If you would, please advise me.

Also, what do I need to add inbetween spaces in file names so that AutoIt picks them up as one word and not two.

Thanks.

Edited by NSearch
Link to comment
Share on other sites

I did not know that you could do that. If you would, please advise me.

Also, what do I need to add inbetween spaces in file names so that AutoIt picks them up as one word and not two.

Thanks.

<{POST_SNAPBACK}>

Are you familiar with Excel VBA IDE ? If not open your workbook then press ALT and F11. Find the code for your macro then cut and paste it in the "Private Sub Workbook_Open()" function.

For spaces:

Use FileGetShortName( "file" ) or enclose in extra quotes '"C:\some folder\some file.xls"'

Link to comment
Share on other sites

bshoenhair,

Thank you for your reponse. When I use the extra set of quotes I get an error:

Run (""C:\Program Files\ Microsoft Office\Office\EXCEL.EXE C:\fedxrem\upseinv analysis.xls"")

Run(""C^ERROR

Error:Unable to parse line.

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