aworthey
07-07-2016, 09:21 AM
I am capturing a screenshot of a userform and pasting it into a temp worksheet to create a PDF. The code is working as I expect it to except for one aspect: it seems to paste first before saving new image to clipboard. That is to say, that each paste event is from previous screen capture. It seems it's a sequence of events problem, but I've not been able to figure it out.
Here's the code:
Dim shape As Excel.shape
For Each shape In ThisWorkbook.Worksheets("temp").Shapes
shape.Delete
Next
ThisWorkbook.Application.SendKeys "(%{1068})"
DoEvents
ThisWorkbook.Worksheets("temp").Paste
DoEvents
The first few lines clears my worksheet before pasting.
Thanks!
Here's the code:
Dim shape As Excel.shape
For Each shape In ThisWorkbook.Worksheets("temp").Shapes
shape.Delete
Next
ThisWorkbook.Application.SendKeys "(%{1068})"
DoEvents
ThisWorkbook.Worksheets("temp").Paste
DoEvents
The first few lines clears my worksheet before pasting.
Thanks!