PC Review


Reply
Thread Tools Rate Thread

copy comments to word

 
 
news
Guest
Posts: n/a
 
      24th Nov 2003
Hi,
I'm having difficulties writing code to copy comments to word.
I'm confused on the "Selection" and/or "Range" Values and how to use them
in this situation.

I need to be able to highlight a range of cells in excel...
Then, copy all the comments in the selected area to a word document.

I have ran across code that will copy the whole workbooks comments but that
is not needed for this.

Thanks for all the help.
Strikker


 
Reply With Quote
 
 
 
 
Debra Dalgleish
Guest
Posts: n/a
 
      24th Nov 2003
The following code will copy the comments in the selected range to Word:

'==============================
Sub CopySelectionCommentsToWord()
Dim rng As Range
Dim c As Range
Dim WdApp As Object

On Error Resume Next
Set WdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Err.Clear
Set WdApp = CreateObject("Word.Application")
End If

Set rng = Selection.Cells.SpecialCells(xlCellTypeComments)

With WdApp
.Visible = True
.Documents.Add DocumentType:=0
For Each c In rng
.Selection.TypeText c.Address _
& vbTab & c.Comment.Text
.Selection.TypeParagraph
Next
End With

Set WdApp = Nothing

End Sub
'====================================

news wrote:
> Hi,
> I'm having difficulties writing code to copy comments to word.
> I'm confused on the "Selection" and/or "Range" Values and how to use them
> in this situation.
>
> I need to be able to highlight a range of cells in excel...
> Then, copy all the comments in the selected area to a word document.
>
> I have ran across code that will copy the whole workbooks comments but that
> is not needed for this.
>
> Thanks for all the help.
> Strikker
>
>



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

 
Reply With Quote
 
news
Guest
Posts: n/a
 
      25th Nov 2003
Many thanks from a newbie!
Works Great!

Strikker

"Debra Dalgleish" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The following code will copy the comments in the selected range to Word:
>
> '==============================
> Sub CopySelectionCommentsToWord()
> Dim rng As Range
> Dim c As Range
> Dim WdApp As Object
>
> On Error Resume Next
> Set WdApp = GetObject(, "Word.Application")
> If Err.Number <> 0 Then
> Err.Clear
> Set WdApp = CreateObject("Word.Application")
> End If
>
> Set rng = Selection.Cells.SpecialCells(xlCellTypeComments)
>
> With WdApp
> .Visible = True
> .Documents.Add DocumentType:=0
> For Each c In rng
> .Selection.TypeText c.Address _
> & vbTab & c.Comment.Text
> .Selection.TypeParagraph
> Next
> End With
>
> Set WdApp = Nothing
>
> End Sub
> '====================================
>
> news wrote:
> > Hi,
> > I'm having difficulties writing code to copy comments to word.
> > I'm confused on the "Selection" and/or "Range" Values and how to use

them
> > in this situation.
> >
> > I need to be able to highlight a range of cells in excel...
> > Then, copy all the comments in the selected area to a word document.
> >
> > I have ran across code that will copy the whole workbooks comments but

that
> > is not needed for this.
> >
> > Thanks for all the help.
> > Strikker
> >
> >

>
>
> --
> Debra Dalgleish
> Excel FAQ, Tips & Book List
> http://www.contextures.com/tiptech.html
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy comments chen Microsoft Word Document Management 1 20th Feb 2008 07:27 AM
Copy Comments =?Utf-8?B?ZmllbGQ4NTg1?= Microsoft Excel Worksheet Functions 1 15th Dec 2005 05:58 AM
Make Word XP comments like Word 97 comments. =?Utf-8?B?TEVF?= Microsoft Word Document Management 1 17th May 2005 05:07 PM
how to copy all comments in one word document, paste into another. =?Utf-8?B?U2hhd24=?= Microsoft Word Document Management 1 22nd Mar 2005 08:28 PM
Copy Comments To Word TC Microsoft Access VBA Modules 1 24th Nov 2003 03:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:00 AM.