Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

Writing to work doc instead of Debug.print

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Barb Reinhardt - 21 Aug 2007 21:22 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.