![]() |
write to word
Hi, Im using streamwriter to write to notepad or word. No problems
with this. Is it possible to write to either notpad or word, while the document is open, and the data to update as its written. At the momment notepad has to be closed, saved and reopened to see the data. Word doesnt allow me to write to it whilst its open. Regards Robert |
write to word
Here's some code that someone probably provided to me to copy comments out of
Excel into Word. You should be able to extract something from that for your purposes: Sub CopyCommentsToWord() Dim cmt As Comment Dim WdApp As Object Dim aWS As Worksheet On Error Resume Next Set WdApp = GetObject(, "Word.Application") If Err.Number < 0 Then Err.Clear Set WdApp = CreateObject("Word.Application") End If Debug.Print "after err.number" With WdApp .Visible = True .Documents.Add DocumentType:=0 For Each aWS In ActiveWorkbook.Worksheets For Each cmt In aWS.Comments .Selection.TypeText cmt.Parent.Address _ & vbTab & cmt.text .Selection.TypeParagraph Next Next aWS End With Set WdApp = Nothing End Sub "RobcPettit" wrote: Hi, Im using streamwriter to write to notepad or word. No problems with this. Is it possible to write to either notpad or word, while the document is open, and the data to update as its written. At the momment notepad has to be closed, saved and reopened to see the data. Word doesnt allow me to write to it whilst its open. Regards Robert |
write to word
Thankyou for your reply, I will have a play around.
Regards Robert |
All times are GMT +1. The time now is 01:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com