Output the Immediate window to printer or screen

Folks,
I would like to add to the below code after the End Width the ability for the user to look at the  Immediate window and then elect to print out those results with the use of a MsgBox
?
Sub DocFormulaWks()
Dim rng As Range

With ActiveSheet
    For Each rng In .UsedRange
        If rng.HasFormula = True Then
        Debug.Print "Addr.: " & rng.Address
        Debug.Print "Form.: " & rng.Formula
        Debug.Print "Value : " & rng.Value
    End If
 Next rng
 End With
 End Sub

Open in new window

Frank FreeseAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
The Immediate Window isn't functional except when debugging/developing.
0
Martin LissOlder than dirtCommented:
You could however send the same data to a label, picturebox, printer and/or some kind of report.
0
Frank FreeseAuthor Commented:
OK - so the output to the Immediate Window can not be sent to a printer but the data could. In the submitted code what would that look like, please.
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Martin LissOlder than dirtCommented:
Just change Debug.Print to Printer.Print and at the end of that add Printer.EndDoc.
0
Frank FreeseAuthor Commented:
Like this?
Sub DocFormulaWks()			
Dim rng As Range			
			
With ActiveSheet			
    For Each rng In .UsedRange			
        If rng.HasFormula = True Then			
        Printer.Print "Addr.: " & rng.Address			
        Printer.Print "Form.: " & rng.Formula			
        Printer.Print "Value : " & rng.Value			
       Printer.EndDoc			
    End If			
 Next rng			
 End With			
End Sub			

Open in new window

0
Martin LissOlder than dirtCommented:
Not quite. Move line 10 to just after line 12 or 13. In other words when you are all done with printing.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Frank FreeseAuthor Commented:
thanks - I guess this is why they pay you the "big" bucks for people like me. As always, I appreciate you
0
Frank FreeseAuthor Commented:
great job!
0
Martin LissOlder than dirtCommented:
YW and thanks for the kind words.

Marty - MVP 2009 to 2013
0
[ fanpages ]IT Services ConsultantCommented:
thanks - I guess this is why they pay you the "big" bucks for people like me. As always, I appreciate you

When did the "Experts" get paid for providing answers to questions?

Am I missing out? ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.