Jump to content
Macro Express Forums

Excel Loosing Paste Function


G Aksland

Recommended Posts

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

Link to comment
Share on other sites

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>>

Link to comment
Share on other sites

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>w1

Wait 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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...