Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-07-2015, 09:09 PM
dlowrey dlowrey is offline Use character instead of line for table border Windows 7 64bit Use character instead of line for table border Office 2010 32bit
Novice
Use character instead of line for table border
 
Join Date: Feb 2012
Posts: 29
dlowrey is on a distinguished road
Default Use character instead of line for table border


Hi
I am automating case captions for legal pleadings. I have a system that does everything but ONE thing. Local court rules won't allow a vertical line. So instead of Word automatically incrementing a right border every time I enter a new line in a table cell; I need to find a way to end each line with a ")". IOW, a vertical line of right justified closed parens, one for each line in the left cell of the table.

I have tried adding a narrow middle cell column in the table just to contain the ")". But can not figured how to auto add a ")" every time a line is added to the left table cell.

I have also thought about trying to substitute a ")" as a custom border, but Word 2013 seems to only allow the silly baked-in graphic images as an alternative to lines for borders.

Thanks in advance for taking time to help with this problem.
-DL

MS Office 2013
Reply With Quote
  #2  
Old 03-08-2015, 01:47 AM
gmayor's Avatar
gmayor gmayor is offline Use character instead of line for table border Windows 7 64bit Use character instead of line for table border Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Your query seems confusing about how many columns the table has and where exactly the brackets are supposed to go, but the following will insert a left bracket at the start of the row and a right bracket at the end of the row, when you tab out of the last cell in the table, thus creating a new row. Tabbing between other cells in the table, merely moves the cursor to the next cell:

Code:
Sub NextCell()
Dim iWidth As Long
Dim iCol As Long
Dim iRow As Long
Dim oRow As Row
Dim oRng As Range
Dim oCell As Cell
Dim oTable As Table

    If Selection.Information(wdWithInTable) = True Then
        Set oTable = Selection.Tables(1)
        Set oRow = Selection.Rows(1)
        iRow = oRow.Index
        iCol = oRow.Cells.Count
        Set oCell = oTable.Cell(iRow, iCol)
        'If the cursor is not in the last cell of the table, move to the next cell
        If Not Selection.InRange(oCell.Range) Or _
           Not Selection.InRange(oTable.Rows.Last.Range) Then
            Selection.Cells(1).Next.Select
            Selection.Collapse 1
            GoTo lbl_Exit
        End If
        'Cursor is in the last cell of the table
        'Locate the end of the cell range
        iWidth = oCell.Width - 12
        'and add a right aligned tab
        oCell.Range.ParagraphFormat.TabStops.Add _
                Position:=iWidth, _
                Alignment:=wdAlignTabRight, _
                Leader:=wdTabLeaderSpaces
        'set a range to the cell with the cursor
        Set oRng = oCell.Range
        'remove the end of cell character
        oRng.End = oRng.End - 1
        'add a right bracket at the end of the cell
        oRng.InsertAfter vbTab & ")"
        'locate the first cell in the row with the cursor
        Set oCell = Selection.Tables(1).Cell(iRow, 1)
        'set a range to that cell
        Set oRng = oCell.Range
        'and insert a left bracket before the cell content
        oRng.InsertBefore "( "
        'and add a new row to the table
        Set oRow = oTable.Rows.Add
        'select the first cell of the new row
        oRow.Cells(1).Select
        'move the selection to the start of the cell
        Selection.Collapse 1
    End If
lbl_Exit:
    Set oTable = Nothing
    Set oRow = Nothing
    Set oCell = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 03-08-2015, 06:19 AM
JimP JimP is offline Use character instead of line for table border Windows 8 Use character instead of line for table border Office 2013
Experienced User
 
Join Date: Jun 2010
Location: Virginia Beach, VA
Posts: 742
JimP will become famous soon enough
Default

Quote:
Originally Posted by dlowrey View Post
Local court rules won't allow a vertical line. So instead of Word automatically incrementing a right border every time I enter a new line in a table cell; I need to find a way to end each line with a ")". IOW, a vertical line of right justified closed parens, one for each line in the left cell of the table.
I know this is toooo simple but, if a vertical line is not allowed (and, you don't say if anything is required) why not simply remove the right border from the table cell?

I know, too simple but, I had to ask.
Reply With Quote
  #4  
Old 03-08-2015, 02:05 PM
dlowrey dlowrey is offline Use character instead of line for table border Windows 7 64bit Use character instead of line for table border Office 2010 32bit
Novice
Use character instead of line for table border
 
Join Date: Feb 2012
Posts: 29
dlowrey is on a distinguished road
Default Legal Pleading, replace vertical line with closing parenthisis

Quote:
Originally Posted by JimP View Post
I know this is toooo simple but, if a vertical line is not allowed (and, you don't say if anything is required) why not simply remove the right border from the table cell?

I know, too simple but, I had to ask.
Apologies if my post was confusing. The right cell margin needs to be a closing parenthesis character; i.e. ")", one for each line in the left table cell. This will make the right border a vertical stack of aligned parens.

Jones )
v ) <-- the parens don't align here, but should stack right aligned in the actual Word table.
Smith )

Thanks for looking the question.
-DL
Reply With Quote
  #5  
Old 03-08-2015, 10:35 PM
gmayor's Avatar
gmayor gmayor is offline Use character instead of line for table border Windows 7 64bit Use character instead of line for table border Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

OK if you only want the parenthesis in the right cell and after each paragraph there modify the previous macro as follows:
http://www.gmayor.com/installing_macro.htm
Code:
Sub NextCell()
Dim iWidth As Long
Dim iCol As Long
Dim iRow As Long
Dim oRow As Row
Dim oRng As Range
Dim oCell As Cell
Dim oPara As Paragraph
Dim rPara As Range
Dim oTable As Table

    If Selection.Information(wdWithInTable) = True Then
        Set oTable = Selection.Tables(1)
        Set oRow = Selection.Rows(1)
        iRow = oRow.Index
        iCol = oRow.Cells.Count
        Set oCell = oTable.Cell(iRow, iCol)
        'If the cursor is not in the last cell of the table, move to the next cell
        If Not Selection.InRange(oCell.Range) Or _
           Not Selection.InRange(oTable.Rows.Last.Range) Then
            Selection.Cells(1).Next.Select
            Selection.Collapse 1
            GoTo lbl_Exit
        End If
        'Cursor is in the last cell of the table
        'Locate the end of the cell range
        iWidth = oCell.Width - 12
        'and add a right aligned tab
        oCell.Range.ParagraphFormat.TabStops.Add _
                Position:=iWidth, _
                Alignment:=wdAlignTabRight, _
                Leader:=wdTabLeaderSpaces
        'set a range to the cell with the cursor
        Set oRng = oCell.Range
        'remove the end of cell character
        oRng.End = oRng.End - 1
        For Each oPara In oRng.Paragraphs
            'add a right bracket at the end of each paragraph in the Right cell
            Set rPara = oPara.Range
            rPara.End = rPara.End - 1
            rPara.InsertAfter vbTab & ")"
        Next oPara
        'and add a new row to the table
        Set oRow = oTable.Rows.Add
        'select the first cell of the new row
        oRow.Cells(1).Select
        'move the selection to the start of the cell
        Selection.Collapse 1
    End If
lbl_Exit:
    Set oTable = Nothing
    Set oPara = Nothing
    Set oRow = Nothing
    Set oCell = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 03-08-2015, 10:43 PM
gmayor's Avatar
gmayor gmayor is offline Use character instead of line for table border Windows 7 64bit Use character instead of line for table border Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The previous macro runs the process as you tab out of the last cell of the table. The following macro run from a button or keyboard shortcut http://www.gmayor.com/installing_macro.htm will add a right tab to each right cell of the current table and add the parenthesis to each paragraph in each right cell.

You can modify one or other macro to give the results you need:
Code:
Sub AddRightTab()
Dim iWidth As Long
Dim iCol As Long
Dim iRow As Long
Dim oRow As Row
Dim oRng As Range
Dim oCell As Cell
Dim oPara As Paragraph
Dim rPara As Range
Dim oTable As Table

    If Selection.Information(wdWithInTable) = True Then
        Set oTable = Selection.Tables(1)
        For Each oRow In oTable.Rows
            iRow = oRow.Index
            iCol = oRow.Cells.Count
            Set oCell = oTable.Cell(iRow, iCol)
            'Locate the end of the cell range
            iWidth = oCell.Width - 12
            'and add a right aligned tab
            oCell.Range.ParagraphFormat.TabStops.Add _
                    Position:=iWidth, _
                    Alignment:=wdAlignTabRight, _
                    Leader:=wdTabLeaderSpaces
            'set a range to the cell with the cursor
            Set oRng = oCell.Range
            'remove the end of cell character
            oRng.End = oRng.End - 1
            For Each oPara In oRng.Paragraphs
                'add a right bracket at the end of each paragraph in the Right cell
                Set rPara = oPara.Range
                rPara.End = rPara.End - 1
                rPara.InsertAfter vbTab & ")"
            Next oPara
        Next oRow
    End If
lbl_Exit:
    Set oTable = Nothing
    Set oPara = Nothing
    Set oRow = Nothing
    Set oCell = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #7  
Old 03-09-2015, 11:29 AM
dlowrey dlowrey is offline Use character instead of line for table border Windows 7 64bit Use character instead of line for table border Office 2010 32bit
Novice
Use character instead of line for table border
 
Join Date: Feb 2012
Posts: 29
dlowrey is on a distinguished road
Default Paren as Right Border in Table Cell

Wow! That is impressive.
I will work work with your code later this week. Thank you for such a complete response.

-DL
Reply With Quote
Reply

Tags
border lines, legal pleading



Similar Threads
Thread Thread Starter Forum Replies Last Post
Use character instead of line for table border Border Special Character vote4gop Word 5 02-28-2015 10:44 PM
Use character instead of line for table border Search for character border = true ? n00bie-n00b Word VBA 6 10-08-2014 11:54 PM
Use character instead of line for table border Aligning Page Border with Table border without losing formatting :mad: l39linden Word Tables 5 10-04-2013 02:06 AM
Use character instead of line for table border How to change the color of Character Border? tinfanide Word 4 10-27-2012 06:35 AM
Use character instead of line for table border Need to remove a line that isn't a cell border msbytes Word 4 08-15-2011 09:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft