Display a Long String in the Word VBA Immediate Window
Question details
The user needs to inspect a long string, such as a hyperlink address, when the Word VBA Immediate window does not show the complete value on one line.

- Product
- Microsoft Word VBA
- Device & OS
- not provided
- Scenario
- Inspecting a long text value or hyperlink address while debugging a Word document.
- Observed behavior
- The Immediate window may not display the complete long string on one line.
Open the Word document containing the hyperlink and confirm that it has at least one hyperlink. In the VBA editor, use Ctrl+G to open the Immediate window.
Print the string in smaller segments
Use this method to inspect the entire value in the Immediate window without relying on one long output line.
In Word, press Alt+F11 to open the VBA editor, then select Insert > Module.
Paste this macro into the module: Sub PrintLinkInChunks() Dim s As String Dim i As Long If ActiveDocument.Hyperlinks.Count = 0 Then MsgBox "The document has no hyperlinks." Exit Sub End If s = ActiveDocument.Hyperlinks(1).Address For i = 1 To Len(s) Step 200 Debug.Print Mid$(s, i, 200) Next i End Sub
Click inside the macro and press F5. Open the Immediate window with Ctrl+G to read the address in 200-character segments.

Place the hyperlink address in a new Word document
Use a temporary document when you want to view, search, or copy the long value as ordinary text.
Show the value in a message box
Use a message box for a quick check when the value is short enough to read there.
Work with Word documents in WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Word documents. It supports common Office formats to help you move existing files into WPS; Microsoft Word VBA debugging still requires Word's VBA editor.

Frequently Asked Questions
How do I open the Immediate window in Word?
Press Alt+F11 to open the VBA editor, then press Ctrl+G or select View > Immediate Window.
How can I inspect a different string instead of a hyperlink?
In the chunk-printing macro, replace `ActiveDocument.Hyperlinks(1).Address` with the string expression you want to inspect, then run the macro with F5.
Why is the hyperlink Address value empty?
The link may point to a location within the document rather than an external address. Inspect `ActiveDocument.Hyperlinks(1).SubAddress` for the internal destination.
Will a message box always show the complete string?
No. A message box can truncate a very long value. Print the string in segments with `Debug.Print` or insert it into a new document instead.




