Q re detecting which table cell is clicked and if ALT, SHIFT or CT

P

Peter

I have an automated marking rubric (basically a Word table with criteria in
rows and standards in the columns) which the user can click in and then press
the f6 function keys to highlight the cell and then record, total and rescale
the mark. If they press F5 the mark is moved down if there is a mark range
and F67 will increase it. You can see a screen movie at
http://emarkingassistant.com/movies/rubric/
..

I would like to change the interface so the user could click a cell and
depending on what modifier key they had held down during the mouse click the
decrement (control), toggle (shift) or increment (Alt) procedures were used.

My question is how to I detect when someone has clicked in a cell in a table
and then return the cell row and column and what modifier key was pressed
when the click occurred. I was going to use the WindowSelectionChange event
as suggested by Greg Maxey at http://gregmaxey.mvps.org/Table_Cell_Data.htm
but i also need to be able to tell if they have clicked in the same cell
again ( so they can unselect it) and this will not fire the event as the
selection has not changed.

Any assistance will be very gratefully received,

Peter Evans

BTW. I am pretty pleased as the above VBA also has Userforms and it works
perfectly on a Mac using Office 2004.
 
F

Fumei2 via OfficeKB.com

"but i also need to be able to tell if they have clicked in the same cell
again ( so they can unselect it) and this will not fire the event as the
selection has not changed."

Word has limited events that are exposed to VBA, so the issue of using
SelectionChange is precsiely that...the Selection has not changed.

Now it could be possible that you declare some Public variables that are set
by each SelectionChange event, and then use those.

Sub SelectionChange
' after testing of course the Selection is in a table....

If Selection.Cells(1).RowIndex = WhatcellRow And _
Selection.Cells(1).ColumnIndex = WhatcellCol Then
msgbox "In the same cell!"
Else
' do whatever
set variables for current Selection cell
WhatcellRow = Selection.Cells(1).RowIndex
WhatcellCol = Selection.Cells(1).RowIndex



You would have to do a lot more fussing to make this sort of thing work.
 

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