PC Review


Reply
Thread Tools Rate Thread

automatically number a table in word document

 
 
VinceW
Guest
Posts: n/a
 
      27th May 2010
The code below opens the correct document but now I would like to number the
cells in the table. The document has 2 tables both with 2 columns in them.
I would like to automatically number the cells in table column 1 of table 2.
Any help is very much appreciated.

Thank you

Dim appWD As Word.Application
Set appWD = CreateObject("Word.Application")
appWD.Documents.Open ("C:\Microsoft Office
Datafiles\Word\DailyNotes\DailyNotes " & strDate & ".doc")
appWD.Visible = True


 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      27th May 2010
Modify the filename to suit...

Dim appWD As Word.Application
Dim docWD As Word.Document

Set appWD = CreateObject("Word.Application")
Set docWD = appWD.Documents.Open("d:\New.doc")

appWD.Visible = True

For intRow = 1 To docWD.Tables(2).Rows.Count
docWD.Tables(2).Cell(intRow, 1).Range.Text = intRow
Next

--
Jacob (MVP - Excel)


"VinceW" wrote:

> The code below opens the correct document but now I would like to number the
> cells in the table. The document has 2 tables both with 2 columns in them.
> I would like to automatically number the cells in table column 1 of table 2.
> Any help is very much appreciated.
>
> Thank you
>
> Dim appWD As Word.Application
> Set appWD = CreateObject("Word.Application")
> appWD.Documents.Open ("C:\Microsoft Office
> Datafiles\Word\DailyNotes\DailyNotes " & strDate & ".doc")
> appWD.Visible = True
>
>

 
Reply With Quote
 
VinceW
Guest
Posts: n/a
 
      27th May 2010
Thank you very much works perfectly.

How about 1 more question for you.

I would like to be able to copy the information from table 2 (column 2) of
document 1, without actually opening the document, and then paste it into
table 2 of this same document. Is that possible?

Thanks again in advance.

"Jacob Skaria" wrote:

> Modify the filename to suit...
>
> Dim appWD As Word.Application
> Dim docWD As Word.Document
>
> Set appWD = CreateObject("Word.Application")
> Set docWD = appWD.Documents.Open("d:\New.doc")
>
> appWD.Visible = True
>
> For intRow = 1 To docWD.Tables(2).Rows.Count
> docWD.Tables(2).Cell(intRow, 1).Range.Text = intRow
> Next
>
> --
> Jacob (MVP - Excel)
>
>
> "VinceW" wrote:
>
> > The code below opens the correct document but now I would like to number the
> > cells in the table. The document has 2 tables both with 2 columns in them.
> > I would like to automatically number the cells in table column 1 of table 2.
> > Any help is very much appreciated.
> >
> > Thank you
> >
> > Dim appWD As Word.Application
> > Set appWD = CreateObject("Word.Application")
> > appWD.Documents.Open ("C:\Microsoft Office
> > Datafiles\Word\DailyNotes\DailyNotes " & strDate & ".doc")
> > appWD.Visible = True
> >
> >

 
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
Re: Is there a way to get Word 2007 to automatically prompt the user to fill out a document summary when saving a new document? Jay Freedman Microsoft Word New Users 0 6th Jan 2011 04:18 AM
Re: Is there a way to get Word 2007 to automatically prompt the user to fill out a document summary when saving a new document? Suzanne S. Barnhill Microsoft Word New Users 0 5th Jan 2011 02:28 AM
How to automatically number a new document(Invoice) when opening =?Utf-8?B?R2lsbHk=?= Microsoft Excel Misc 0 13th Sep 2005 02:45 PM
How do I make a document automatically number when opened in Word =?Utf-8?B?c3RhY2V5dg==?= Microsoft Word Document Management 1 1st Jun 2005 09:02 PM
Number Lists that automatically start in a new document =?Utf-8?B?SG9sbHkgRA==?= Microsoft Word Document Management 1 8th Apr 2004 12:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:20 PM.