Copy to Clipboard and so that I may paste to any other program
After wasting a lot of time trying to find a straightforward way to do this,
I created the following subroutine that opens a workbook, puts the variable
(passed to the subroutine as an argument) in cell A1, copies that to the
clipboard, then closes the new workbook. With all the great things that can
be done with VBA and Excel, I would think there would be an easier way to do
this.
Public Sub CopyToClipboard(VariableToBeSaved)
' created by Patricia Shannon Aug. 22, 2006
' Copy variable to Clipboard
Workbooks.Add
Cells(1, 1) = VariableToBeSaved
Cells(1, 1).Copy
ActiveWorkbook.Close savechanges:=False
End Sub
In the subroutine where you need to save the variable, you would have
copytoclipboard(yourvariablehere)
"tomwashere2" wrote:
I would simply like to know how to specify that I would like to store a
variable value to the clipboard so that I can paste that information to other
programs at my own discretion. Thanks!!!
|