G Aksland Posted July 10, 2005 Report Share Posted July 10, 2005 Excel 2002, ME 3.5 I have 2 workbooks open, using ME 3.5 to switch to window 2, pause and wait for "enter", then I highlight the cell I want to copy, then press "enter", the macro copys, then executes a ctrl Shift F6 which switches back to the previous window 1. At this time the paste function is greyed out and not available. It seems just using ME cancles the paste buffer in excel 2002. Any ideas? G Aksland Quote Link to comment Share on other sites More sharing options...
randallc Posted July 11, 2005 Report Share Posted July 11, 2005 Hi, Don't know; can you post a bit of code and I can test on another computer? Best, Randall Quote Link to comment Share on other sites More sharing options...
cyberchief Posted July 11, 2005 Report Share Posted July 11, 2005 Or a quick work-around would be to copy and set a variable from the clipboard... and text type the variable. Quote Link to comment Share on other sites More sharing options...
G Aksland Posted July 11, 2005 Author Report Share Posted July 11, 2005 This is the code I am trying to use <REM2:>>>> Purpose, to switch windows in excel> <REM2:>>> copy a cell and switch back> <REM2:>>> and paste same into window 2> <REM2: ----------------------><REM2:Switch to window 1 in excel> <REM2:Note Ctrl Shift 6 will swap windows, this dosnt work either> <TEXTTYPE:<ALT>w1 ><MSD:150> <REM2:Wait for enter key so I can navagate to the desired cell to copy> <WAITKEY2:000001:000000:50> <REM2:Copy cell> <CLIPC><REM2:Switch to window 2 in excel> <REM2:Note, at this point if I stop the macro, all the> <REM2:paste options in excel> <REM2:are greyed out as if the escape key was pressed> <REM2:after the copy in excel> <TEXTTYPE:<ALT>w2 ><MSD:200><REM2:Paste special values> <TEXTTYPE:<ALT>esv<ENTER>> Quote Link to comment Share on other sites More sharing options...
randallc Posted July 12, 2005 Report Share Posted July 12, 2005 Hi, Are you leaving long enough after you pres "enter"?; this works for me; <TEXTTYPE:<ALT>w1><WAITKEY2:000010:000000:50><IMSD:500><CLIPC><IMSD:500><TEXTTYPE:<ALT>w2><CLIPP> Text Type: <ALT>w1Wait for Key Press: ENTER Delay 500 Milliseconds Clipboard Copy Delay 500 Milliseconds Text Type: <ALT>w2 Clipboard Paste But that delay is excessive. Do you realise this will copy the cell below where you hit "enter" if "enter" is used to move down one cell (as set in my excel)? Best, Randall Quote Link to comment Share on other sites More sharing options...
G Aksland Posted July 12, 2005 Author Report Share Posted July 12, 2005 Thanks Randall for your help This is perplexing, I am using the following I switched to using the Ctrl key for the wait to test, but now when focus returns to window 2 in excel, it automatically pastes without any paste command, as you can see the last window switch command then some how it's pasting the results without any past command. I need a paste value anyway because I'm pasting a formula needing only the value. <TEXTTYPE:<CONTROL><SHIFT><F6> ><WAITKEY2:000001:000000:51><MSD:500> <CLIPC><MSD:500> <TEXTTYPE:<CONTROL><SHIFT><F6> Thanks again Gary Quote Link to comment Share on other sites More sharing options...
randallc Posted July 12, 2005 Report Share Posted July 12, 2005 Hi, Did you know if you copy my code into script editor, it will copy the script? - Did you try using it? You are making it more difficult to read by inserting "line breaks" etc. You are probably in trouble with the command after that you have posted; you are trying to open another window ("paste Special") and not waiting for it before sending more keys; <TEXTTYPE:<CONTROL><SHIFT><F6>><WAITKEY2:000001:000000:51><IMSD:100><CLIPC><IMSD:100><TEXTTYPE:<CONTROL><SHIFT><F6>><IMSD:60><TEXTTYPE:<ALT><ALT>es><WAITWIN2:000010:000000:Paste Special><TEXTTYPE:v<ENTER>> Text Type: <CONTROL><SHIFT><F6>Wait for Key Press: CTRL Delay 100 Milliseconds Clipboard Copy Delay 100 Milliseconds Text Type: <CONTROL><SHIFT><F6> Delay 60 Milliseconds Text Type: <ALT><ALT>es Wait For Window Title: "Paste Special" Text Type: v<ENTER> Best, Randall PS I agree with you there seems to be lack of waiting for the "control" key sometimes here when not expected; I think there is some way to empty it from the keyboard buffer too; better to not use a key you have just pressed (Cntrl-Shft-F6) in the "wait for key" command) I would prefer to use named windows and waits if you can; <WMAX:Book1><WMAX:Book2><ACTIVATE2:Book1><WAITWIN2:000010:000000:Book1><WAITKEY2:000001:000000:51><CLIPC><ACTIVATE2:Book2><WAITWIN2:000010:000000:Book2><TEXTTYPE:<ALT><ALT>es><WAITWIN2:000010:000000:Paste Special><TEXTTYPE:v<ENTER>> Window Maximize: "Book1"Window Maximize: "Book2" Activate Window: "Book1" Wait For Window Title: "Book1" Wait for Key Press: CTRL Clipboard Copy Activate Window: "Book2" Wait For Window Title: "Book2" Text Type: <ALT><ALT>es Wait For Window Title: "Paste Special" Text Type: v<ENTER> Quote Link to comment Share on other sites More sharing options...
G Aksland Posted July 12, 2005 Author Report Share Posted July 12, 2005 Hi Randall, That worked like a charm after changing the window names. Do you use the "The First Book About Macro Express ", I was considering it. The Wait for window is definatly the way to go. I have owned ME for about 8 years, reading this forum really helps with the programming concepts. Thanks so much for your input Gary Quote Link to comment Share on other sites More sharing options...
randallc Posted July 13, 2005 Report Share Posted July 13, 2005 Hi again, Yes, "Macro Express Explained" has really helped me heaps since it came out last year; I can thoroughly recommend it; there's so much to the program I would never have thought about otherwise (there still is...!) Best, Randall Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.