I'd like to write all of my "debug.print" lines to a Word doc. I've done
Excel programming before but nothing in Word, so need some assistance.
This is what I have that needs to be converted.
If wdDoc Is Nothing Then
Set wdDoc = Documents.Add
End If
'Want to copy this to the wdDoc
Debug.Print
Debug.Print oDoc.Name
For i = 1 To 26
Debug.Print i, DataArray(i, 1), DataArray(i, 2)
Next i
Thanks,
Barb Reinhardt
Shauna Kelly - 23 Aug 2007 10:13 GMT
Hi Barb
There are lots of ways you could do that. Here's one:
If wdDoc Is Nothing Then
Set wdDoc = Documents.Add
End If
wdDoc.Range.InsertAfter oDoc.Name & vbCrLf
For i = 1 To 10
wdDoc.Range.InsertAfter i & vbTab & DataArray(i, 1) & vbTab &
DataArray(i, 2) & vbCrLf
Next i
'to save the document
wdDoc.Save
'or, to save and close the document
wdDoc.Close SaveChanges:=True
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> I'd like to write all of my "debug.print" lines to a Word doc. I've done
> Excel programming before but nothing in Word, so need some assistance.
[quoted text clipped - 15 lines]
> Thanks,
> Barb Reinhardt