Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    reDeleteing 'squares' in Word teable cells (Word 2000 SP2)

    I have a Word document with a table. The table has four cells per row and approximately four hunderd rows. For some reason, (not sure why), a square box appears at the start of each cell except cell 1 ie in cells 2, 3 and 4. I have created a macro to remove the squares row by row however as I recorded this it doesn't always work as there are some blank cells and rows as well. I tried a Find and Replace to remove all the squares but Word seems to be treating the squares as spaces. Is there anyway using VBA I can find and delete the squares? THe macros I recorded was

    Sub DeleteSquare()
    '

    Selection.MoveRight Unit:=wdCell
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=2
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.TypeBackspace
    Selection.TypeBackspace
    Selection.MoveRight Unit:=wdCell
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=2
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.TypeBackspace
    Selection.MoveRight Unit:=wdCell
    Selection.MoveLeft Unit:=wdCharacter, Count:=2
    Selection.MoveRight Unit:=wdCharacter, Count:=2
    Selection.TypeBackspace
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=26
    Selection.MoveLeft Unit:=wdCell
    End Sub

    Thanking you in advance

    John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: reDeleteing 'squares' in Word teable cells (Word 2000 SP2)

    Try the following:
    - Select a square
    - Activate the Visual Basic Editor (Alt+F11)
    - Activate the Immediate window (Ctrl+G)
    - Type ? Asc(Selection) then press Enter
    - Note the number that is displayed
    - Close the Visual Basic Editor (Alt+F4)
    - Open the Replace dialog (Ctrl+H)
    - Type ^ followed by the number you noted in the Find What box
    - Leave the Replace With box blank.
    - Click Replace All.

    If that doesn't help, could you post a small demo document, with just a few cells containing squares? Remove or alter the rest of the text if necessary.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: reDeleteing 'squares' in Word teable cells (Word 2000 SP2)

    One possibility is that your table is corrupted and the squares you see represent the disintegration of the codes that separate cells. To diagnose and/or remedy that, the best approach is to copy the whole table to a clean document and use Table>Convert>Convert Table to Text, separated with Tabs (if there are line breaks inside cells, this is a terrible mess, but hopefully you won't have this problem). If the converted data is clean (no squares), convert back to a table. If the squares are still there, then "never mind." <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: reDeleteing 'squares' in Word teable cells (Word 2000 SP2)

    Tried both suggestions but unfortunately they didn't solve the problem. I attach a striped down Word document with the offending table.

    Thank you again for all your help.

    Kind regards

    John

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: reDeleteing 'squares' in Word teable cells (Word 2000 SP2)

    My suggestion in <post#=313794>post 313794</post#> works on the document you attached:
    - Select a square.
    - Use the Immediate window to obtain its ASCII code. Turns out to be 6.
    - In the Replace dialog, enter ^6 in the Find What box, leave Replace With blank.
    - Replace All gets rid of the squares in one fell swoop.

  6. #6
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: reDeleteing 'squares' in Word teable cells (Word 2000 SP2)

    Hans,

    Brillant! For some reason before I managed to get an ASCII code of 68. That's why I believed it had failed.

    Thanks again for all your help, very much appreciated.

    Regards

    John

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: reDeleteing 'squares' in Word teable cells (Word 2000 SP2)

    >> an ASCII code of 68

    That is the ASCII code for capital D, so you probably selected the wrong character by accident...

    I'm glad you got it to work now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •