|
Question : Is there a way to access the Office clipboard using Visual Basic in Word?
|
|
Is there a way to access the Office clipboard using Visual Basic in Word?
The reason I ask is because in my VB I copy something and then paste it. Now I want to clear what I copied out of the clipboard and have whatever was in it before my VB started accessible to paste again (so my users can paste whatever they may have copied last). I know Word has a built in Clipboard manager and I thought a good solution would be if I could access the commands related to it, I could probably delete the last copied clip.
A different solution would also be great.
Thanks.
|
|
Answer : Is there a way to access the Office clipboard using Visual Basic in Word?
|
|
doug, here's a ms link for you WD98: Sample VB Code to Assign Clipboard Text to String Variable http://support.microsoft.com/default.aspx?scid=kb;en-us;183644 its got this code: Sub GetClipBoardText() Dim MyData As DataObject Set MyData = New DataObject Dim sClipText As String On Error GoTo NotText ' Get data from the clipboard. MyData.GetFromClipboard ' Assign clipboard contents to string variable. sClipText = MyData.GetText(1) MsgBox sClipText NotText: If Err <> 0 Then MsgBox "Data on clipboard is not text." End If End Sub
which seems to work for me (this just reads but there could be more in the link, i didn't read that far
|
|
|