You have to login in order to post a reply to this topic.

4 replies [Last post]
ianbush
User offline. Last seen 51 weeks 5 days ago. Offline
Joined: 12/12/2009
Posts: 17

Hi,

Having trouble with the following task, I have attached a screen shot to show what I programmed.

The problem is it all works except for Excel seems to ignore the control key and just types in G

I want the macro to send control G to fire the macro I have recored in this workbook (which works if I do it manually by pressing control G.

Any suggestions ? 

Ian

 

AttachmentSize
Untitled-1.jpg1.6 KB
ianbush
User offline. Last seen 51 weeks 5 days ago. Offline
Joined: 12/12/2009
Posts: 17
Re: Problem Automating a Macro Enabled Excel worksheet

Here is a PDF version should be better to read !

Thanks in advance

AttachmentSize
Doc1.pdf 153.96 KB
masterwaldo
User offline. Last seen 7 weeks 5 days ago. Offline
Joined: 12/15/2009
Posts: 24
Re: Problem Automating a Macro Enabled Excel worksheet

Hi, I used to face this problem last time.

 

Instead of using this: {Control}(G)

Try to put curly braces like this: {Control}({G}).

 

You can read more about it here: http://www.winautomation.com/kb/send-keys-use-modi...

ianbush
User offline. Last seen 51 weeks 5 days ago. Offline
Joined: 12/12/2009
Posts: 17
Re: Problem Automating a Macro Enabled Excel worksheet

Thanks you so much, Its now working perfectly !

codex
codex's picture
User offline. Last seen 18 weeks 4 days ago. Offline
Joined: 11/12/2009
Posts: 161
Re: Problem Automating a Macro Enabled Excel worksheet

Something else that you may come across (and can trouble you): when you want to write to an Excel document, you have 2 options. You can either use the "Write to Excel" action or you can go to a specific cell (probably by sending a Ctrl+G keystroke combination) and write to it using the "Send Keys" action. If you write through the "Send Keys" action to an Excel's cell, and then immediately select to close Excel and save the document (with the "Close Excel" action), an error occurs.

The reason for that is that Excel actually thinks that the user is trying to write something to the cell (in other words, the user is still editing the document) so it refuses to save it and close. In order to save the document, you will first have to tell Excel that you have finished editing the document (e.g. send an <Enter> keystroke) and then use the "Close Excel" action to close and save the xls(x) document.

__________________

Error is not blindness, error is cowardice

__________________

Error is not blindness, error is cowardice