Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default OLEObjects .. again

Hi,

I posted previously in this newsgroup regarding OLEObjects. All I want to
do is to be able to create controls in a Worksheet from a UserForm. I
realised my previous post may not have been very clear, so I have a bare
bones example.

1. Create a UserForm with a button on .
2. The code for the buttons on click event handler:

Private sub btnTest_Click()
Dim oOLE as OLEObject
Set oOLE = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Combo Box.1", _
Left:=10, Top:=10, Width:=100, Height:=50)
end sub

Run the macro, click the button and voila the combobox appears, but the
UserForm disappears. I do not want this to happen as the form is an
interactive one that will need to create lots of controls. Is this a
problem with Focus, ZOrder or something like that? How do I keep the form
visible?

Any help appreciated, I am going slightly mad.

Cheers

Roy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default OLEObjects .. again

Set the ShowModal property of the form to true.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roy" wrote in message
...
Hi,

I posted previously in this newsgroup regarding OLEObjects. All I want to
do is to be able to create controls in a Worksheet from a UserForm. I
realised my previous post may not have been very clear, so I have a bare
bones example.

1. Create a UserForm with a button on .
2. The code for the buttons on click event handler:

Private sub btnTest_Click()
Dim oOLE as OLEObject
Set oOLE = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Combo Box.1", _
Left:=10, Top:=10, Width:=100, Height:=50)
end sub

Run the macro, click the button and voila the combobox appears, but the
UserForm disappears. I do not want this to happen as the form is an
interactive one that will need to create lots of controls. Is this a
problem with Focus, ZOrder or something like that? How do I keep the form
visible?

Any help appreciated, I am going slightly mad.

Cheers

Roy




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default OLEObjects .. it works!

Cheers for that Bob - it works! Thank you for your help.

Any idea why a non-modal form does not work? What has happened to the
form - it is still there somewhere.

Cheers

Roy
"Bob Phillips" wrote in message
...
Set the ShowModal property of the form to true.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roy" wrote in message
...
Hi,

I posted previously in this newsgroup regarding OLEObjects. All I want
to
do is to be able to create controls in a Worksheet from a UserForm. I
realised my previous post may not have been very clear, so I have a bare
bones example.

1. Create a UserForm with a button on .
2. The code for the buttons on click event handler:

Private sub btnTest_Click()
Dim oOLE as OLEObject
Set oOLE = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Combo Box.1", _
Left:=10, Top:=10, Width:=100, Height:=50)
end sub

Run the macro, click the button and voila the combobox appears, but the
UserForm disappears. I do not want this to happen as the form is an
interactive one that will need to create lots of controls. Is this a
problem with Focus, ZOrder or something like that? How do I keep the
form
visible?

Any help appreciated, I am going slightly mad.

Cheers

Roy






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default OLEObjects .. it works!

Not sure, that surprised me. I will do some investigations.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roy" wrote in message
...
Cheers for that Bob - it works! Thank you for your help.

Any idea why a non-modal form does not work? What has happened to the
form - it is still there somewhere.

Cheers

Roy
"Bob Phillips" wrote in message
...
Set the ShowModal property of the form to true.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Roy" wrote in message
...
Hi,

I posted previously in this newsgroup regarding OLEObjects. All I want
to
do is to be able to create controls in a Worksheet from a UserForm. I
realised my previous post may not have been very clear, so I have a

bare
bones example.

1. Create a UserForm with a button on .
2. The code for the buttons on click event handler:

Private sub btnTest_Click()
Dim oOLE as OLEObject
Set oOLE = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Combo Box.1", _
Left:=10, Top:=10, Width:=100, Height:=50)
end sub

Run the macro, click the button and voila the combobox appears, but the
UserForm disappears. I do not want this to happen as the form is an
interactive one that will need to create lots of controls. Is this a
problem with Focus, ZOrder or something like that? How do I keep the
form
visible?

Any help appreciated, I am going slightly mad.

Cheers

Roy








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
OLEObjects Roy[_8_] Excel Programming 1 May 6th 05 03:51 AM
Problem activating OLEObjects Peter Fopma Excel Programming 1 November 9th 04 11:48 AM
Taking over OLEObjects... Possible ?! Alex T Excel Programming 4 June 16th 04 11:02 AM
OLEObjects clickable? Erich Neuwirth Excel Programming 1 June 8th 04 04:27 AM
Glolbal Variables Reset when using OleObjects Rock Excel Programming 11 May 31st 04 03:00 AM


All times are GMT +1. The time now is 11:30 AM.

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

About Us

"It's about Microsoft Excel"