Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
How do I determine if an entire cell is selected vs...
Hello,
I am trying to figure out how I can programatically determine if an entire cell has been selected (by the user clicking on the border around the cell) as opposed to simply having the cursor in the cell. I've tried everything I can think of with Word.Selection but can't find any differences. My problem is that I am inserting bookmarks into the cell, but whenever the entire cell is selected, Word's formatting character for the cell ends up within the bookmark and I need to prevent this. Thank you. David |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
How do I determine if an entire cell is selected vs...
Hi David,
I don't know if this will help - I don't really know Visual Basic - but I do know that there are different ways to "access" a cell. You can click into the cell - between characters. You can also use the arrow to select the cell. Or you can use the right arrow key to move from the last character in a cell to the first character in the next cell. Maybe using the arrow key is what you want? Rich "David Cardinale" wrote: Hello, I am trying to figure out how I can programatically determine if an entire cell has been selected (by the user clicking on the border around the cell) as opposed to simply having the cursor in the cell. I've tried everything I can think of with Word.Selection but can't find any differences. My problem is that I am inserting bookmarks into the cell, but whenever the entire cell is selected, Word's formatting character for the cell ends up within the bookmark and I need to prevent this. Thank you. David |
#3
Posted to microsoft.public.word.tables
|
|||
|
|||
How do I determine if an entire cell is selected vs...
Hi David
If you turn on non-printing characters (see http://www.word.mvps.org/FAQs/Format...rintChars.htm), you'll see that every cell is marked with an end-of-cell marker. If the user has the whole cell selected, then the selection will include that end-of-cell marker. But if the user has only selected some text (perhaps even all the text, but not the cell itself), then the selection will not include the end-of-cell marker. The end-of-cell marker is actually 2 characters: chr(13) & chr(7), and you can test for those in your code. Hope this helps. Shauna Kelly. Microsoft MVP. http://www.shaunakelly.com/word "David Cardinale" David wrote in message ... Hello, I am trying to figure out how I can programatically determine if an entire cell has been selected (by the user clicking on the border around the cell) as opposed to simply having the cursor in the cell. I've tried everything I can think of with Word.Selection but can't find any differences. My problem is that I am inserting bookmarks into the cell, but whenever the entire cell is selected, Word's formatting character for the cell ends up within the bookmark and I need to prevent this. Thank you. David |
#5
Posted to microsoft.public.word.tables
|
|||
|
|||
How do I determine if an entire cell is selected vs...
This is exactly what I needed. Thank You!
"Tony Jollans" wrote: Something like this should cover all the possibilities: If Selection.Information(wdWithInTable) Then If Selection.Cells.Count 1 Then MsgBox "Selection spans more than one Cell" Else If Selection.Range = Selection.Cells(1).Range Then MsgBox "Whole Cell selected" Else MsgBox "Partial Cell selected" End If End If Else MsgBox "Selection not in a Table" End If -- Enjoy, Tony "David Cardinale" David wrote in message ... Hello, I am trying to figure out how I can programatically determine if an entire cell has been selected (by the user clicking on the border around the cell) as opposed to simply having the cursor in the cell. I've tried everything I can think of with Word.Selection but can't find any differences. My problem is that I am inserting bookmarks into the cell, but whenever the entire cell is selected, Word's formatting character for the cell ends up within the bookmark and I need to prevent this. Thank you. David |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
filling entire table cell in Word? | Tables | |||
Cell border confusion after cells are merged | Tables | |||
VBA: For Each Cell in Range jumps out of range? | Tables | |||
cell marker missing - can not type text into cell | Tables | |||
cell's background color not printed correctly | Tables |