Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
David Cardinale David Cardinale is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.word.tables
RichN RichN is offline
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.word.tables
Shauna Kelly Shauna Kelly is offline
external usenet poster
 
Posts: 571
Default 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



  #4   Report Post  
Posted to microsoft.public.word.tables
Tony Jollans Tony Jollans is offline
external usenet poster
 
Posts: 1,308
Default How do I determine if an entire cell is selected vs...

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



  #5   Report Post  
Posted to microsoft.public.word.tables
David Cardinale David Cardinale is offline
external usenet poster
 
Posts: 2
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
filling entire table cell in Word? mpmc Tables 1 August 6th 06 10:56 PM
Cell border confusion after cells are merged Hack Tables 5 February 22nd 06 01:30 PM
VBA: For Each Cell in Range jumps out of range? Ed Tables 2 January 26th 06 05:51 PM
cell marker missing - can not type text into cell Mary Smith 360 Tables 1 December 20th 05 05:04 AM
cell's background color not printed correctly [email protected] Tables 2 December 19th 05 12:44 PM


All times are GMT +1. The time now is 03:22 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"