![]() |
|
|
|
#1
|
|||
|
|||
|
I would not attempt stripping it from the clipboard, but from the pasted text. If necessary, you could create a scratch document, paste it there, and clear it from the pasted text, then copy that and close the scratch document without saving, then you would have it in the clipboard.
Here is a macro that unlinks all hyperlinks in the first table of a document. Code:
Sub HyperlinkFieldUnlink()
' Charles Kenyon 2023-01-22
Dim oField As Field
Dim oRange As range
On Error Resume Next
Set oRange = ActiveDocument.Tables(1).range
For Each oField In oRange.Fields
If oField.Type = wdFieldHyperlink Then
oField.Unlink
End If
Next oField
Set oField = Nothing
On Error GoTo -1
Set oRange = Nothing
End Sub
|
|
#2
|
|||
|
|||
|
Hi Charles,
This works nicely, too. I was able to modify your code so the table, sans hypertext, is copied to the clipboard. Thank you! The reason I want to strip hypertext from the clipboard, rather than from the table, is that the text, after it's copied, doesn't get pasted. I assign whatever is in the clipboard to a text variable, and parse it. But I know nothing about the metadata associated with the hypertext, so I can't delete it. I was hoping there might be a way to unlink hypertext from the clipboard before I assign the clipboard to a variable. |
|
#3
|
|||
|
|||
|
Quote:
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing hypertext to normal text | tcritchley07 | Word | 2 | 11-23-2019 09:52 AM |
| Error with Clipboard - Getting Spaces Out of Clipboard | StephenRay | Word VBA | 14 | 09-27-2017 01:07 PM |
Hypertext links within document? (not to a website)
|
cosiyak | Word | 1 | 05-22-2011 01:26 PM |
Hypertext Question
|
Juc1 | Word | 6 | 05-05-2011 06:09 AM |
hypertext link to a specific page of a pdf file
|
serbring | OneNote | 6 | 03-04-2011 01:20 AM |