Adding string to PrintOut?

E

Ed from AZ

At the end of my (XL2007) macro code, I have
wks1.Range("BA" & rwSt - 1 & ":BG" & rwEnd + 11).PrintOut

During the macro execution, I build a multi-line text string (multi-
lined by virtue of several vbCrLf), and show it to the user via
MsgBox.

How can I add the multi-line text string to my PrintOut?
Preferably on a separate page?

Ed
 
D

Dave Peterson

Dim NewWks as worksheet
....

Set NewWks = worksheets.add

with newwks
with .range("A1")
.wrapText = True
.value = myString 'whatever your variable is
'any more formatting you want -- widen the column, increase the rowheight??
.printout 'preview:=true 'for testing
end with
application.displayalerts = false
.delete
application.displayalerts = true
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top