Selection.Copy on Temporarily unhidden excel sheet - possible bug?

J

Joshua

I have an excel workbook that has 3 worksheets (Input, Output, Clipboard)

Input is the only visible sheet and is used to input the variables.
Output is used for spawning a new excel sheet with a customized view.
Clipboard is used for when copying the data into word or another application.

My code looks like this:

Sub clipcopy()
'Copies the output sheet to clipboard so a user can paste into Powerpoint or
Word
Application.ScreenUpdating = False
Sheets("clipboard").Visible = True
Sheets("clipboard").Select
Range("A1:D18").Select
Selection.Copy
Sheets("Input").Activate
Application.ScreenUpdating = True
MsgBox ("The sheet is copied to the clipboard." & vbCrLf & vbCrLf & "Keep
this window open until you have finished pasting into another application.")
Sheets("clipboard").Visible = False

The problem is if you close the msgbox window and try to paste into word it
pastes as hidden text.

If you keep the msgbox open and paste into word it pastes normally.

This works but seems a bit messy to me. Is there another way I could
accomplish? Apparently when Sheets("clipboard").Visible = False is set, it
also affects whats already in the clipboard.

Thanks for any help you can provide, and if you would like a copy of the
file let me know.
 
J

Joshua

Still awaiting an answer but thinking it through some more today as I was
waiting.

It seems like a bug to me because when you do a selection.copy it should be
in the clipboard. When I make the sheet hidden again it seems like it's
going back into the clipboard and changing that data to hidden.

Is it perhaps possible to copy as a picture or an object that excel cannot
modify after the fact?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top