I got a Excel sheet with the Word "John" in a cell.
I want to put it in a variable and write it in the cell below.
(it could of course be done much easier, but I am doing
it this way for testing)
The cursor moves all right but I get nothing written. Could someone
please tell me what I am doing wrong?
SetFocus>Excel*
Press CTRL
Send Character/Text>c
Release CTRL
GetClipBoard>Name
Press Right
Press Down
Press Left
Wait>2
PutClipBoard>Name
Wait>2
Press CTRL
Send Character/Text>v
Release CTRL
My very first macro
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I think the main problem may be Trailing Spaces, or it is possible that you have not selected anything to be copied? see note 4 below.
A number of things to watch for:
1. Remove any trailing spaces at the end of lines. This is especially important on Send, Goto, Label, all variables, like "name" in a few places.
2. Some programs are Case Sensitive with CTRL / ALT characters. Excel shows UPPERCASE C / V for Copy/Paste, you are using lowercase. Might not make a difference in Excel, but just a cautionary note.
3. Useful to refer to variable contents by using %percents% around the variables. Leave off the %percents% when you are referring to setting the value of the variable.
4. I know this is only a test macro, but I am a little confused. When you are using PutClipBoard, it does not seem that you are just putting back what is already there. I read your macro like this:
In an Excel spreadsheet, copy contents of current cell (are you on a cell?) to the clipboard(nothing is selected?)and call the contents "name", move down one cell, put "name" or the word "name" into the clipboard replacing what is already there, and paste the clipboard contents into the same cell.
Are you trying to copy contents from one cell to next lower cell? Try this (untested), assuming case is correct, and located in cell with contents to start:
A number of things to watch for:
1. Remove any trailing spaces at the end of lines. This is especially important on Send, Goto, Label, all variables, like "name" in a few places.
2. Some programs are Case Sensitive with CTRL / ALT characters. Excel shows UPPERCASE C / V for Copy/Paste, you are using lowercase. Might not make a difference in Excel, but just a cautionary note.
3. Useful to refer to variable contents by using %percents% around the variables. Leave off the %percents% when you are referring to setting the value of the variable.
4. I know this is only a test macro, but I am a little confused. When you are using PutClipBoard, it does not seem that you are just putting back what is already there. I read your macro like this:
In an Excel spreadsheet, copy contents of current cell (are you on a cell?) to the clipboard(nothing is selected?)and call the contents "name", move down one cell, put "name" or the word "name" into the clipboard replacing what is already there, and paste the clipboard contents into the same cell.
Are you trying to copy contents from one cell to next lower cell? Try this (untested), assuming case is correct, and located in cell with contents to start:
If you want to use Clipboard, try something lilke this (untested):SetFocus>Excel*
Press CTRL
Send Character/Text>C
Release CTRL
Press Right
Press Down
Press Left
Press CTRL
Send Character/Text>V
Release CTRL
SetFocus>Excel*
Press CTRL
Send Character/Text>C
Release CTRL
Press Right
Press Down
Press Left
GetClipBoard>Name
Send Character/Text>%Name%
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
My very first macro
Thankyou Bob for your kind help!
What I really am up to is to read 8 cells of information in a row in Excel,
and put them into variables.
The cells hold mixed text and numbers with decimal comma.
Then switch to another application (ORACLE economical program) and insert them there. in 8 different fields. The insertion have to be performed through tab, enter is not valid.
I wanted to try out your code but get a error message
at the first line SetFocus>*Excel*
"Specified Window *Excel* Not Present.
Any Subsequent Key Sends In Script May Cause Exceptions"
It´s pussling
It is very strange as I have a window open and this line used to work
Regards
ConradPlutt
What I really am up to is to read 8 cells of information in a row in Excel,
and put them into variables.
The cells hold mixed text and numbers with decimal comma.
Then switch to another application (ORACLE economical program) and insert them there. in 8 different fields. The insertion have to be performed through tab, enter is not valid.
I wanted to try out your code but get a error message
at the first line SetFocus>*Excel*
"Specified Window *Excel* Not Present.
Any Subsequent Key Sends In Script May Cause Exceptions"
It´s pussling
It is very strange as I have a window open and this line used to work
Regards
ConradPlutt
Maybe that's the reason.SetFocus>window_title
Sets focus to the specified window. The window_title may contain the * symbol at the end to indicate a wildcard.
There's no option to get something like this wildcarded
Micosoft Excel - MyExcelWorkbookName.xls
Try to get the windows title and to set the focus to it, this way:
FindWindowWithText>text_to_find,1,WindowName
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
may not be totally correct.There's no option to get something like this wildcarded
MyExcelWorkbookName.xls
will work to get the Window for Excel. You may have to take additional steps to get to a specific workbook.SetFocus>Micosoft Excel - *
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!