I have two macros that work independantly, when I call them in succession - I get an error - I traced the error to be located at a line:
I am trying to make a copy of the BlankOut sheet at the end of my sheets. The error does not occur right away - to elaborate my input macro basically gets run ten times, and then my outputs start, it will complete the first 3 outputs fine, but on the fourth time around my problem line, it errors out.
My theory on it was that my clipboard was not happy with the amount of copying and pasting going on. By the time I get to the error, my macro has copy and pasted 400+ items, most of which are images (Visio images to be precies). I tried using:
Which I grabbed from the macro recorder to clear the clipboard, but in practice it does not seem to work - I stepped through my project with the office clipboard open and did not see it reset ever.
The overall macro works fine on smaller projects, when they get larger I can no longer paste sheets in, and it then jumps to an error. I don't get a run-time error, it just jumps to:
From
I am a bit perplexed as to what is causing this, while I feel like it has something to do with memory limits of some kind, I do not know how to do the housekeeping needed on the clipboard.
I used the search a bit on the boards, and saw some suggestions on using the line I posted to clear the clipboard but it is not working for me.
Because it works fine if I only have 5 inputs and 5 outputs, and errors out if I have 10 inputs and 10 outputs, I feel like it is running into some limits, any thoughts?
Thanks
Naveed
Code:
Sheets("BlankOut").Copy After:=Sheets(Sheets.Count)
I am trying to make a copy of the BlankOut sheet at the end of my sheets. The error does not occur right away - to elaborate my input macro basically gets run ten times, and then my outputs start, it will complete the first 3 outputs fine, but on the fourth time around my problem line, it errors out.
My theory on it was that my clipboard was not happy with the amount of copying and pasting going on. By the time I get to the error, my macro has copy and pasted 400+ items, most of which are images (Visio images to be precies). I tried using:
Code:
Application.CutCopyMode = False
Which I grabbed from the macro recorder to clear the clipboard, but in practice it does not seem to work - I stepped through my project with the office clipboard open and did not see it reset ever.
The overall macro works fine on smaller projects, when they get larger I can no longer paste sheets in, and it then jumps to an error. I don't get a run-time error, it just jumps to:
Code:
MyError:
MsgBox ("ERROR")
From
Code:
On Error GoTo MyError
I am a bit perplexed as to what is causing this, while I feel like it has something to do with memory limits of some kind, I do not know how to do the housekeeping needed on the clipboard.
I used the search a bit on the boards, and saw some suggestions on using the line I posted to clear the clipboard but it is not working for me.
Because it works fine if I only have 5 inputs and 5 outputs, and errors out if I have 10 inputs and 10 outputs, I feel like it is running into some limits, any thoughts?
Thanks
Naveed