Greg
Thu Feb 28 07:40:49 PST 2008
I didn't try vbCrlf but you can use vbCr:
Sub ScratchMacro()
Dim pStr1 As String
Dim pStr2 As String
pStr1 = "Alpha, Bravo, Charlie ..."
pStr2 = "...Yankee, Xray, Zulu"
'Instead of:
MsgBox pStr1 & pStr2
'Use:
Dim oDoc As Document
Set oDoc = Documents.Add
With oDoc.Range
.Text = pStr1 & vbCr & pStr2
.Font.Name = "Arial Black"
.Font.Size = "24"
End With
oDoc.PrintOut
oDoc.Close wdDoNotSaveChanges
End Sub
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greg Maxey - Word MVP
My web site
http://gregmaxey.mvps.org
Word MVP web site
http://word.mvps.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Dandeli0n" <Dandeli0n@discussions.microsoft.com> wrote in message
news:7C6D0F9C-7A74-467C-856B-404B02693B01@microsoft.com...
> Dear Greg,
>
> this looks very promising! Thank you
>
> How can i specify the font and so on for this document?
>
> And, can I use "& vbcrlf" for line breaks?
>
> Again, thank you!
> Dande
>
> "Greg Maxey" wrote:
>
>> Sub ScratchMacro()
>> Dim pStr1 As String
>> Dim pStr2 As String
>> pStr1 = "Alpha, Bravo, Charlie ..."
>> pStr2 = "...Yankee, Xray, Zulu"
>> 'Instead of:
>> MsgBox pStr1 & pStr2
>> 'Use:
>> Dim oDoc As Document
>> Set oDoc = Documents.Add
>> oDoc.Range.Text = pStr1 + pStr2
>> oDoc.PrintOut
>> oDoc.Close wdDoNotSaveChanges
>> End Sub
>>
>> --
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Greg Maxey - Word MVP
>>
>> My web site
http://gregmaxey.mvps.org
>> Word MVP web site
http://word.mvps.org
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>>
>> Dandeli0n wrote:
>> > At the end of my Word macro I use a msgbox filled with text and the
>> > value of some strings
>> >
>> > is it possible to print the value of these strings in a document or
>> > to print the msgbox as a whole?
>>
>>
>>