Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default write to word

Thankyou for your reply, I will have a play around.
Regards Robert

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how i can write arabic numbers by microsoft excel word medo Excel Discussion (Misc queries) 1 February 10th 09 12:48 AM
HOW PUT WORD-ART IN THE BACKGROUND AND WRITE OVER IT Militza Excel Worksheet Functions 1 August 25th 08 06:52 PM
Write to Word Document from Excel VBA Help Needed JudyHNM Excel Programming 2 April 26th 07 02:28 AM
How can you write a formula that searches for a particular word? trainer07 Excel Programming 1 August 22nd 06 05:25 PM
How to write in Word w/o Reference Gérard Ducouret Excel Programming 4 April 7th 06 03:04 PM


All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"