I'm trying to get a recorded Word 2000 macro to pick up the contents of the clipboard, but I don't know the VBA syntax. Can I write something like .Text = GetFromClipboard within the With Selection.Find section below? I need the line .Text = "Sc" below to reflect the current and changing contents of the windows clipboard, which for my purposes will be just 2 letters of the alphabet, but not necessarily “Sc”.
Selection.Copy
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Sc"
.Wrap = wdFindContinue
.Format = True
End With
IN REGARD TO PREVIOUS RESPONSES, when I put
Dim MyData As DataObject and
Set MyData = New DataObject
at the top of the module, I get
"User-defined type not defined." erors on both of those statements when I try to run the macro.
I assume that I embed the
MyData.GetFromClipboardstrClip and the
strClip = MyData.GetText
statments right after the relevant
Selection.Copy statement
and then, finally, use
.Text = strClip
within the relevant With Selection.Find statement??
Selection.Copy
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Sc"
.Wrap = wdFindContinue
.Format = True
End With
IN REGARD TO PREVIOUS RESPONSES, when I put
Dim MyData As DataObject and
Set MyData = New DataObject
at the top of the module, I get
"User-defined type not defined." erors on both of those statements when I try to run the macro.
I assume that I embed the
MyData.GetFromClipboardstrClip and the
strClip = MyData.GetText
statments right after the relevant
Selection.Copy statement
and then, finally, use
.Text = strClip
within the relevant With Selection.Find statement??