Sign in to follow this  
Followers 0
NSearch

Excel Macro

12 posts in this topic

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Send("^+i")

This also does not work

Edited by NSearch

Share this post


Link to post
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")

Share this post


Link to post
Share on other sites

I was just about to ask if I had to wait for it to load up. I really like this already!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

How do I send an <enter> command?

Disreguard, I found it.

Edited by NSearch

Share this post


Link to post
Share on other sites

Send("{ENTER}")

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Did you "WRITE" this macro in VBA or did excel do it for you ?

Did you know that excel can execute this macro itself when you open the workbook ?

More efficient I think.

Edited by bshoenhair

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
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"'

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

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
Sign in to follow this  
Followers 0