Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default "De"-select a forms control programmatically

Hello,

in a short VBA-macro, I have to select a forms control on a worksheet, and
assign a "cell-link" to.
After that, the control should not stay selected, so that the worksheet user
doesn't accidentally delete it.

To that end, right now the last step in my macro is to select a one cell
range, but that doesn't always seem to be the best solution.
I've tried with Sendkeys {Escape}, in vain.

Any idea how to "de-"select a forms control by VBA ?

Thank you in advance.

Regards,

H.G. Lamy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default "De"-select a forms control programmatically

What's wrong with selecting a cell, eg

ActiveCell.Select

But why are you Select'ing the control in the first place, you don't need to
merely to assign it's LinkCell property

Regards,
Peter T

"H.G. Lamy" wrote in message
...
Hello,

in a short VBA-macro, I have to select a forms control on a worksheet, and
assign a "cell-link" to.
After that, the control should not stay selected, so that the worksheet
user doesn't accidentally delete it.

To that end, right now the last step in my macro is to select a one cell
range, but that doesn't always seem to be the best solution.
I've tried with Sendkeys {Escape}, in vain.

Any idea how to "de-"select a forms control by VBA ?

Thank you in advance.

Regards,

H.G. Lamy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default "De"-select a forms control programmatically

Peter, thank you for feed back.

Selecting a cell - if this cell happens to be outside the visible screen
area - makes the cursor jump there. Then the user has to scroll back.

Manipulating a control without prior selecting it doesn't seem to work (I
use XL 2003).

Regards,

hgl


"Peter T" <peter_t@discussions wrote in message
...
What's wrong with selecting a cell, eg

ActiveCell.Select

But why are you Select'ing the control in the first place, you don't need
to merely to assign it's LinkCell property

Regards,
Peter T

"H.G. Lamy" wrote in message
...
Hello,

in a short VBA-macro, I have to select a forms control on a worksheet,
and assign a "cell-link" to.
After that, the control should not stay selected, so that the worksheet
user doesn't accidentally delete it.

To that end, right now the last step in my macro is to select a one cell
range, but that doesn't always seem to be the best solution.
I've tried with Sendkeys {Escape}, in vain.

Any idea how to "de-"select a forms control by VBA ?

Thank you in advance.

Regards,

H.G. Lamy





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default "De"-select a forms control programmatically

Selecting a cell - if this cell happens to be outside the visible screen
area - makes the cursor jump there. Then the user has to scroll back.


Dim vr As Range
Set vr = ActiveWindow.VisibleRange
If Not Intersect(vr, ActiveCell) Is Nothing Then
ActiveCell.Activate
Else
vr(1).Activate
End If
' bit more if the selection is a pre 2007 embedded chart

But as you don't need to select you don't need that

Manipulating a control without prior selecting it doesn't seem to work (I
use XL 2003).


Dim ole As OLEObject
Set ole = ActiveSheet.OLEObjects("Combobox1")
ole.LinkedCell = "B2"

Regards,
Peter t


"H.G. Lamy" wrote in message
...
Peter, thank you for feed back.

Selecting a cell - if this cell happens to be outside the visible screen
area - makes the cursor jump there. Then the user has to scroll back.

Manipulating a control without prior selecting it doesn't seem to work (I
use XL 2003).

Regards,

hgl


"Peter T" <peter_t@discussions wrote in message
...
What's wrong with selecting a cell, eg

ActiveCell.Select

But why are you Select'ing the control in the first place, you don't need
to merely to assign it's LinkCell property

Regards,
Peter T

"H.G. Lamy" wrote in message
...
Hello,

in a short VBA-macro, I have to select a forms control on a worksheet,
and assign a "cell-link" to.
After that, the control should not stay selected, so that the worksheet
user doesn't accidentally delete it.

To that end, right now the last step in my macro is to select a one cell
range, but that doesn't always seem to be the best solution.
I've tried with Sendkeys {Escape}, in vain.

Any idea how to "de-"select a forms control by VBA ?

Thank you in advance.

Regards,

H.G. Lamy







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default "De"-select a forms control programmatically

Thank you,

I had recorded the code to change the control's properties, and that code
always works with "select" - but not without. Yours does!

Kind regards,

hgl

"Peter T" <peter_t@discussions wrote in message
...
Selecting a cell - if this cell happens to be outside the visible screen
area - makes the cursor jump there. Then the user has to scroll back.


Dim vr As Range
Set vr = ActiveWindow.VisibleRange
If Not Intersect(vr, ActiveCell) Is Nothing Then
ActiveCell.Activate
Else
vr(1).Activate
End If
' bit more if the selection is a pre 2007 embedded chart

But as you don't need to select you don't need that

Manipulating a control without prior selecting it doesn't seem to work (I
use XL 2003).


Dim ole As OLEObject
Set ole = ActiveSheet.OLEObjects("Combobox1")
ole.LinkedCell = "B2"

Regards,
Peter t


"H.G. Lamy" wrote in message
...
Peter, thank you for feed back.

Selecting a cell - if this cell happens to be outside the visible screen
area - makes the cursor jump there. Then the user has to scroll back.

Manipulating a control without prior selecting it doesn't seem to work (I
use XL 2003).

Regards,

hgl


"Peter T" <peter_t@discussions wrote in message
...
What's wrong with selecting a cell, eg

ActiveCell.Select

But why are you Select'ing the control in the first place, you don't
need to merely to assign it's LinkCell property

Regards,
Peter T

"H.G. Lamy" wrote in message
...
Hello,

in a short VBA-macro, I have to select a forms control on a worksheet,
and assign a "cell-link" to.
After that, the control should not stay selected, so that the worksheet
user doesn't accidentally delete it.

To that end, right now the last step in my macro is to select a one
cell range, but that doesn't always seem to be the best solution.
I've tried with Sendkeys {Escape}, in vain.

Any idea how to "de-"select a forms control by VBA ?

Thank you in advance.

Regards,

H.G. Lamy









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
=EMBED("Forms.CheckBox.1","") John[_22_] Excel Programming 7 December 12th 08 02:44 AM
"Control" plus "click" doesn't allow me to select multiple cells Ken Cooke New Users to Excel 0 September 25th 06 04:46 PM
Scroll Bar missing "Control" tab in "Format Properties" dialog box Peter Rooney Excel Discussion (Misc queries) 5 August 24th 06 05:36 PM
How to programmatically control "Vary colors by point" Ambrose Excel Programming 0 October 29th 04 11:41 AM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"