Question

I'm trying to automate some excel processing. With autoit I open several Excel with an add-in. This add-in is used to update data in this excel.

In autoit I managed to open the excel files with the add-in but now I need to select the menuitem to update the excel automatically. I don't have any clue howto do this in autoit3.

I can't find any tutorials or manual howto do this.

Was it helpful?

Solution

If you know the keystroke(s) for the menu command, you can use the AutoIt Send function.

For example, the Save function in Excel is CTRL+s.

In AutoIt, that would be:

Send("^s")

OTHER TIPS

It sounds like you would be better off with an Excel macro instead. If you click "tools>macros>record new macro" and set the name of that auto_open then select the cells you want to update and update them and then stop recording, you will have a macro that refreshes the cells every time you open them. If you want a separate file that refreshes all the files you can make a new spreadsheet and start recording and use file open to have opening (or closing) a spread sheet included in the code. Don't forget to have that macro save too.

PS- If you need to open the file without the macro running you need to open excel first then hold shift when you open the file using the "file>open" path.

I see from your other question on StackOverflow that you are using the ExcelCOM library. You must realize that the MenuItem you are trying to click does some operation on the underlying code in the same way as the ExcelCOM library.

The best solution for your problem is to find out which methods the MenuItem calls, and then reproduce the same behavior with the ExcelCOM library. What you mean by "Update the excel automatically" I don't understand, otherwise I would have found out how to reproduce the behavior by ExcelCOM for you.

If you're using excel 2007 (I am not sure about earlier versions) and higher there is a combination of letters you can use in queue to call (probably) every menu option you want. When you have the excel open - press and release Alt button and you will see letters below main menu options, like in the picture, http://img.photobucket.com/albums/v479/vaeryn/Excel1_zps98c2f450.png Then letter by letter you may dig down the menu option you wish.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top