Lorenz Meyer
Lorenz Meyer

Reputation: 19945

How to access long string value at runtime

I found a problem with the VBA Locals Window while debuggin a macro in Excel 2013. I used the Locals Window to track the value of a string.

If the string exceed a certain length (about 100 caracters) it is not possible to copy it out of the Locals Window to examine it somewhere else (eg. in notepad++).

Is there a way to access the full content of a string variable at runtime ?

Upvotes: 2

Views: 1400

Answers (1)

ScottLenart
ScottLenart

Reputation: 1210

You can also dump the output to a txt file. "response" is the variable to output in the below example.

Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim oFile As Object
Set oFile = fso.CreateTextFile("C:\Development\DebugOutput.txt")
oFile.WriteLine response
oFile.Close
Set fso = Nothing
Set oFile = Nothing

Upvotes: 1

Related Questions