Count Number of Selected Cells In A Table?

H

Hapless

Is there a way to determine how many cells have been selected in a table? We
work with very large tables of various sizes, from which we often have to
transfer data to a graphics layout application (Adobe InDesign) that just
isn't Word friendly. One of our compositors is working on a script to
translate tables into InDesign templates, and he tells me it would be helpful
for his purposes to know how many cells the user has selected, but that
doesn't seem to be something Word tells you.

Does Word provide this info in some place I don't know, or would it have to
be a macro-based solution? (If the latter, I'll repost to the VBA section.)

Thanks for your help!
 
M

macropod

Hi Hapless,

You could use a macro like:
Sub SelectionCellCount()
If Selection.Information(wdWithInTable) Then _
MsgBox "Selection Cell Count: " & Selection.Cells.Count
End Sub

You could assign such a macro to a keyboard shortcut to facilitate its use.
 
H

Hapless

Extremely helpful, macropod! I've passed the code on to the fellow writing
the script. Very cool!

Sorry about the delayed response, but I left work early yesterday. Thank you
so much!

macropod said:
Hi Hapless,

You could use a macro like:
Sub SelectionCellCount()
If Selection.Information(wdWithInTable) Then _
MsgBox "Selection Cell Count: " & Selection.Cells.Count
End Sub

You could assign such a macro to a keyboard shortcut to facilitate its use.

--
Cheers
macropod
[MVP - Microsoft Word]


Hapless said:
Is there a way to determine how many cells have been selected in a table? We
work with very large tables of various sizes, from which we often have to
transfer data to a graphics layout application (Adobe InDesign) that just
isn't Word friendly. One of our compositors is working on a script to
translate tables into InDesign templates, and he tells me it would be helpful
for his purposes to know how many cells the user has selected, but that
doesn't seem to be something Word tells you.

Does Word provide this info in some place I don't know, or would it have to
be a macro-based solution? (If the latter, I'll repost to the VBA section.)

Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top