ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Selection doesn't work (https://www.excelbanter.com/excel-programming/395657-copy-selection-doesnt-work.html)

nxqviet

Copy Selection doesn't work
 
Hi all,

I have a macro that contains this following code. This is a very basic
copy code that copy a selection in Excel and Pates it to an opened
MS.Word application at a specified bookmark. This very long macro
works fine 80% of the time, but once in a while, the script would just
skip right over the Selection.copy part and then promt an error at the
Pates part, since the clipboard is indeed empty....

Application.Goto ("RangeA")
Range("RangeA").Select
Selection.Copy
WRD.Selection.Goto what:=wdGoToBookmark, Name:="BMarkA"
WRD.Selection.Paste

When debugging the error, i see that RangeA was selected, but never
copied (no flashing border around it). Then, I would just drag the
Yellow Arror back to the Application.Goto part, and make it repeat the
script, it would work fine. This error only happen once in a while, I
don't understand. Could it be the code? Could it be the memory? Please
help.

Thank you very much for you time and your help,

V_



All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com