Seleting objects instead of cells ??

keldsor

New Member
Joined
Jun 9, 2017
Messages
42
I have a workbook with a worksheet with a lot of shapes like DOT.

Each dot represents an event and I can get the details for a specific event shown in Word by double clicking on the DOT for the event I want to see the details for.

I HAVE to do "double clicking" for the details to show up in Word AND bring Word in front on the screen, BUT ...

unfortunately this "double clicking" takes Excel out of "Selecting objects"-mode and inte "Selecting cells"-mode !

When I opens the workbook I have this code to secure it opens in "Select objects"-mode:

Code:
Private Sub Workbook_Open()
    If ActiveSheet.Shapes.Count > 0 Then Application.CommandBars.ExecuteMso "ObjectsSelect"
End Sub
How can I sort of "lock the workbook in that "Select-Objects-mode" ?
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,493
Office Version
2016
Platform
Windows
I guess you have a macro assigned to each object in order to open Word - Right? If so then you should just click the objects (shapes) ... no need to double-click them.
 
Last edited:

keldsor

New Member
Joined
Jun 9, 2017
Messages
42
I guess you have a macro assigned to each object in order to open Word - Right? If so then you should just click the objects (shapes) ... no need to double-click them.
As I write, I HAVE to double click to get Word in front.

If I just click then a Word icon is blinking in the process line and I have to click on that icon to get Word in front.

What about this locking I was asking for ?
 
Last edited:

keldsor

New Member
Joined
Jun 9, 2017
Messages
42
I guess you have a macro assigned to each object in order to open Word - Right? If so then you should just click the objects (shapes) ... no need to double-click them.
Yeah, I just tried again very carefully ... and you're right just a single click is enough ... BUT

IF the user is a little excited and make a double click then it brings Excel out of this "Select object"-mode and it works no more !

That's why I asked for that "locking" mothod OR some code to FORCE the mode on again - I tried this:

Application.CommandBars.ExecuteMso "ObjectsSelect"

in the .OnAction method chain but it doesn't turn the mode on again.
 

keldsor

New Member
Joined
Jun 9, 2017
Messages
42
I tried this too in the .OnAction method chain - I found out it's a toggle switch, so I have to check the state first:

Code:
    With Application.CommandBars
        If .GetPressedMso("ObjectsSelect") = False Then .ExecuteMso "ObjectsSelect"
    End With
Doesn't do it either !
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,493
Office Version
2016
Platform
Windows
I am not entirely sure I understand but try this ans see if it works for you :

Code in the ThisWorkbook Module:
Code:
Option Explicit

Private WithEvents cmbrs As CommandBars

Private Sub Workbook_Open()
    With Application
        If ActiveSheet.Shapes.Count > 0 Then .CommandBars.ExecuteMso "ObjectsSelect": Set cmbrs = .CommandBars
    End With
    Call cmbrs_OnUpdate
End Sub

Private Sub cmbrs_OnUpdate()
    With Application.CommandBars
        If .GetPressedMso("ObjectsSelect") = False Then .ExecuteMso "ObjectsSelect"
    End With
End Sub
 
Last edited:

keldsor

New Member
Joined
Jun 9, 2017
Messages
42
I am not entirely sure I understand but try this ans see if it works for you :

Code in the ThisWorkbook Module:
Code:
Option Explicit

Private WithEvents cmbrs As CommandBars

Private Sub Workbook_Open()
    With Application
        If ActiveSheet.Shapes.Count > 0 Then .CommandBars.ExecuteMso "ObjectsSelect": Set cmbrs = .CommandBars
    End With
    Call cmbrs_OnUpdate
End Sub

Private Sub cmbrs_OnUpdate()
    With Application.CommandBars
        If .GetPressedMso("ObjectsSelect") = False Then .ExecuteMso "ObjectsSelect"
    End With
End Sub
It works in the sence that the "Select object"-mode is NOT turned off if the user fools around making click or double click on the dots, BUT ...

now the bringing Word in front does NOT work by just (one) click on the dot = the Word icon in the process line is blinking and I have to click on this icon to bring Word in front.
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,493
Office Version
2016
Platform
Windows
I am confused because in your first post you said that you need to double-click the word icond and now you want it to work by just one click !

Can you explain more clearly what you would like to happen ?

And what exactly do you mean by "dot" ?
 
Last edited:

keldsor

New Member
Joined
Jun 9, 2017
Messages
42
I am confused because in your first post you said that you need to double-click the word icond and now you want it to work by just one click !

Can you explain more clearly what you would like to happen ?

And what exactly do you mean by "dot" ?
A DOT is MY representing of an event on a timeline - just a circle small enough to show as a DOT .. 2-3 millimeters in diameter.

In my first posting I was NOT aware of that you just have to single click on a DOT ... and then Word opens and comes into front - I was fooling around not clear on single and/or double clicking - but as I write in posting #4 it works as you said.

I want it to open Word showing the details for the event I'm clicking on - I don't care if I should use single or double click.

What fooled me into talking about this double clicking was because the "Select object"-mode was turned OFF and then NOTHING works at all.

Now it SEEMS like I HAVE to double click to get Word in front with the details ... argh !

In fact it was BETTER before = a single click ... BUT the "Select object"-mode must NOT be turned off IF you accidently makes a double click.
 

keldsor

New Member
Joined
Jun 9, 2017
Messages
42
I now played some time with the last solution ... and it works nicely !

I think I'm fooled by some open (=active) VBA code windows when it's NOT working ;))

I now started a testrun from Desktop and ALL other closed .... and it work as I want it to !

Thx for your time !
 

Forum statistics

Threads
1,082,257
Messages
5,364,074
Members
400,778
Latest member
Canadian Sal

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top