Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
MathKing MathKing is offline
external usenet poster
 
Posts: 2
Default In Word 2003 how to insert characters before all cell markers

I want to insert a character before the cell marker in many cells in a table.
I can't use the find and replace feature. There must be a way to do this (or
to delete a character before every cell marker). Can someone help me?
  #2   Report Post  
Posted to microsoft.public.word.tables
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default In Word 2003 how to insert characters before all cell markers

Hi MathKing,

You could add text to the end of each selected cell via a macro like:
Sub AddDemo()
Dim oCel As Cell, StrTxt As String
StrTxt = InputBox("What is the text to insert at the end of each selected cell")
For Each oCel In Selection.Cells
oCel.Range.InsertAfter (StrTxt)
Next
End Sub

Similarly, you can delete the last character with:
Sub DelDemo()
Dim oCel As Cell, lStr As Long
For Each oCel In Selection.Cells
lStr = oCel.Range.Characters.Count
If lStr 1 Then oCel.Range.Characters(lStr - 1).Delete
Next
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


"MathKing" wrote in message ...
I want to insert a character before the cell marker in many cells in a table.
I can't use the find and replace feature. There must be a way to do this (or
to delete a character before every cell marker). Can someone help me?

  #3   Report Post  
Posted to microsoft.public.word.tables
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default In Word 2003 how to insert characters before all cell markers

Hi Macropod.
Again a very nice little macro set.
Question though, how can the first macro be changed to deal with any and all
tables within a document not just selected cells, and also have the text to
be inserted preset?
Many thanks
DeanH

"macropod" wrote:

Hi MathKing,

You could add text to the end of each selected cell via a macro like:
Sub AddDemo()
Dim oCel As Cell, StrTxt As String
StrTxt = InputBox("What is the text to insert at the end of each selected cell")
For Each oCel In Selection.Cells
oCel.Range.InsertAfter (StrTxt)
Next
End Sub

Similarly, you can delete the last character with:
Sub DelDemo()
Dim oCel As Cell, lStr As Long
For Each oCel In Selection.Cells
lStr = oCel.Range.Characters.Count
If lStr 1 Then oCel.Range.Characters(lStr - 1).Delete
Next
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


"MathKing" wrote in message ...
I want to insert a character before the cell marker in many cells in a table.
I can't use the find and replace feature. There must be a way to do this (or
to delete a character before every cell marker). Can someone help me?


  #4   Report Post  
Posted to microsoft.public.word.tables
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default In Word 2003 how to insert characters before all cell markers

Hi Dean,

You could use something like:
Sub AddAllDemo()
Dim oTbl As Table, oCel As Cell, StrTxt As String
StrTxt = "MyText"
For Each oTbl In ActiveDocument.Tables
For Each oCel In oTbl.Cells
oCel.Range.InsertAfter (StrTxt)
Next
Next
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


"DeanH" wrote in message ...
Hi Macropod.
Again a very nice little macro set.
Question though, how can the first macro be changed to deal with any and all
tables within a document not just selected cells, and also have the text to
be inserted preset?
Many thanks
DeanH

"macropod" wrote:

Hi MathKing,

You could add text to the end of each selected cell via a macro like:
Sub AddDemo()
Dim oCel As Cell, StrTxt As String
StrTxt = InputBox("What is the text to insert at the end of each selected cell")
For Each oCel In Selection.Cells
oCel.Range.InsertAfter (StrTxt)
Next
End Sub

Similarly, you can delete the last character with:
Sub DelDemo()
Dim oCel As Cell, lStr As Long
For Each oCel In Selection.Cells
lStr = oCel.Range.Characters.Count
If lStr 1 Then oCel.Range.Characters(lStr - 1).Delete
Next
End Sub

--
Cheers
macropod
[Microsoft MVP - Word]


"MathKing" wrote in message ...
I want to insert a character before the cell marker in many cells in a table.
I can't use the find and replace feature. There must be a way to do this (or
to delete a character before every cell marker). Can someone help me?


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
How do I limit characters typed into a Word Table cell? Maureen Microsoft Word Help 2 May 7th 23 02:51 PM
When placing cursor to insert characters it deletes characters scott66moore Microsoft Word Help 1 October 11th 08 11:05 PM
Can not insert Latin Characters (Word 2003) Antrix Microsoft Word Help 1 September 7th 08 06:44 PM
Re Word 2003: How do I define a cell as a header cell? John Kwasnik Tables 4 September 5th 08 11:44 PM
How do I move from cell to cell iin a table column in Word 2003? MOSwannabe Tables 4 January 26th 06 11:17 PM


All times are GMT +1. The time now is 05:00 PM.

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"