Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tables have data (Word 2003)

    Hi loungers,
    I have autotext tables with 2 3 4 5 columns I need to know if all (or most) cells have data as condition before emailing with a toolbar button on custom toolbar for this document only.

    If too many cells are blank user sees msgbox ask Please complete table before emailing document.

    Can anyone help please?

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Tables have data (Word 2003)

    You should be able to adapt this to do what you need...

    StuartR

    <code>
    Sub BlankCellsInDoc()

    Dim iTotalCells As Long
    Dim iBlankCells As Long
    Dim tblTemp As Table
    Dim clTemp As Cell

    For Each tblTemp In ActiveDocument.Content.Tables
    For Each clTemp In tblTemp.Range.Cells
    iTotalCells = iTotalCells + 1
    If clTemp.Range.Characters.Count < 2 Then iBlankCells = iBlankCells + 1
    Next clTemp
    Next tblTemp

    If MsgBox("Blank Cells: " & Str$(iBlankCells) & vbCrLf & _
    "Total Cells: " & Str$(iTotalCells) & vbCrLf & _
    "Do you want to continue or Cancel?", vbOKCancel) _
    = vbOK Then
    <font color=448800>' Do whatever you need when the user clicks OK here</font color=448800>
    End If

    End Sub
    </code>

  3. #3
    New Lounger
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables have data (Word 2003)

    Thank you Stuart,
    I just found something about all cells blank and was working with that? But this is super. Will give it a whirl right now.

    Many thanks.

Posting Permissions

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