View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Preserve contents of Clipboard when altering display options

as I've never done anything in VB6

You won't need any experience with VB6 for this.
It is as simple as ABC as in the example Sub.

RBS

"Peter Rooney" wrote in message
...
RB,
I'll give this a go, but as I've never done anything in VB6, it may take
me
some time. Also, the system on which I want to run the Clipboard
preservation
will be used by multiple users, so there may be a licensing issue for me.

Thank you for your help! :-)

Pete



"RB Smissaert" wrote:

If using the API is too much trouble then you could use the attached VB6
ActiveX dll.
Just set a reference to it in the VBE under Tools, References and run
Regsvr32 and use it as in this example:

Sub test()

'VB6 ActiveX dll with the only the following code in a class module:

'Public Sub SetClipboardString(strString As String)
'Clipboard.Clear
'Clipboard.SetText strString
'End Sub

'Public Function GetClipboardString() As String
'GetClipboardString = Clipboard.GetText
'End Function

'Public Sub ClearClipboard()
'Clipboard.Clear
'End Sub

Dim strString

SetClipboardString "test"
strString = GetClipboardString

MsgBox strString

ClearClipboard

MsgBox GetClipboardString

End Sub


RBS


"Peter Rooney" wrote in message
...
That would be ideal, if you happened to know how I reference the
clipboard
contents in VBQ!

Thanks!

Pete



"RB Smissaert" wrote:

If it is in VBA you could store the clipboard in a variable and
restore
from
that after your code.

RBS

"Peter Rooney" wrote in
message
...
Good morning, all,

I notice that if I copy something to the clipboard, then alter any
of
the
application or window display settings, the contents of the
Clipboard
are
lost.

This happens in "Normal" Excel too, as well as in VBA - can anyone
suggest
a
way of somehow preserving the contents of the clipboard?
I'm using Excel 2003.

Thanks in advance

Pete