Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default insert new cell in specific table, then populate with text?

I'd like to insert a new cell in a specific table, and then populate
the cell with autotext so that it inserts an image.

I've been trying to figure this out looking at VB code, but am too
novice.

I want the macro to say something like, For tables with style r-note in
row (1,1), insert a new cell before 1,1 and then populate the new cell
with the text "noteicon".

My attempt to code this was something like this:

Sub FormatNotes()

Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
If oTbl.Cell(1, 1).Range.Style = _
ActiveDocument.Styles("R-note") Then
With oTbl

Selection.InsertCells ShiftCells:=wdInsertCellsShiftRight
For Each aBorder In Selection.Borders

[got confused here -- no idea how to populate a specific cell]

End With
End If
End Sub

Can someone help me make this work?

Also, if I want to define the color of the cell borders in a table,
what's the property for that?

Thanks.

  #2   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default insert new cell in specific table, then populate with text?

I thought of a method that might be easier. All I'm trying to do is set
up a one-row table with two columns. In the left column, I want there
to be a note icon. In the right column, I want there to be note text.

In my Word document, I'll have the following, tagged with a r-note
style:

noteicon $ Note: This is sample text and so on.

Here's what I want the macro to do:

1. Find each instance of text with the r-note style.
2. Convert this text into a 2-column table using $ as the separator.
3. Make the left column 1 inch long, the right column 5 inches long.
4. Indent the table 1 inch.
5. Remove the cell borders.
6. Replace all instances of the text noteicon with a specific image
file.

I would really appreciate anyone's help. This is the last macro I need
to complete my RoboHelp output conversion process.

  #3   Report Post  
Posted to microsoft.public.word.tables
Tom Tom is offline
external usenet poster
 
Posts: 61
Default insert new cell in specific table, then populate with text?

I found a different way of getting around this problem. I applied used
a style switch using a table style in Word and it worked great. Here's
the code:

Sub ConvertNotesFlush()

Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
If oTbl.Cell(1, 1).Range.Style = _
ActiveDocument.Styles("R-notetable-flush") Then
With oTbl

.Style = ActiveDocument.Styles("notetable-flush")

End With
End If
Next oTbl
End Sub

"R-notetable-flush" is the style in RoboHelp and "notetable-flush" is
the table style.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Two rows per row? Ed Sheehan Tables 8 December 20th 06 07:34 PM
error messages when using table formula after moving column tot's hunguponword Tables 3 November 26th 06 03:27 AM
Losing textbox on table Jack Tables 13 November 21st 06 03:09 AM
How can I implement a specific text style within a table? MichaelB Tables 1 May 21st 06 08:26 AM
I want text from the cells in one table repeated in other tables Reg Tables 2 February 14th 06 01:53 PM


All times are GMT +1. The time now is 11:41 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"