Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default what object var should I use for the following code

I recorded the following code for adding a scrollbar to a sheet.... no
problem. So I cut and paste the code into my module and it runs fine.
However what I can not figure out is what OBJECT varriable I can use with
this statement so I can use the object varriable in the WITH END WITH
cinstruct so I can reach and change different properties of the control.

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289 _
).Select
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default what object var should I use for the following code

dim OLEObj as OLEObject
set oleobj = activesheet.oleobjects.add(...)
with oleobj
....

Depending on what you're doing, you may want:

With OLEObj.object
....



TONY wrote:

I recorded the following code for adding a scrollbar to a sheet.... no
problem. So I cut and paste the code into my module and it runs fine.
However what I can not figure out is what OBJECT varriable I can use with
this statement so I can use the object varriable in the WITH END WITH
cinstruct so I can reach and change different properties of the control.

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289 _
).Select


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default what object var should I use for the following code

Sub HowToDoIt()
Dim objSB As OLEObject
Dim cw As Long
cw = 20
Set objSB = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289)
objSB.Name = "Mush"
Set objSB = Nothing
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"TONY"
wrote in message
I recorded the following code for adding a scrollbar to a sheet.... no
problem. So I cut and paste the code into my module and it runs fine.
However what I can not figure out is what OBJECT varriable I can use with
this statement so I can use the object varriable in the WITH END WITH
cinstruct so I can reach and change different properties of the control.

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289 _
).Select
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default what object var should I use for the following code

When I try this I get the following Error message.

"Cant enter break mode at this time"

"Jim Cone" wrote:

Sub HowToDoIt()
Dim objSB As OLEObject
Dim cw As Long
cw = 20
Set objSB = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289)
objSB.Name = "Mush"
Set objSB = Nothing
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"TONY"
wrote in message
I recorded the following code for adding a scrollbar to a sheet.... no
problem. So I cut and paste the code into my module and it runs fine.
However what I can not figure out is what OBJECT varriable I can use with
this statement so I can use the object varriable in the WITH END WITH
cinstruct so I can reach and change different properties of the control.

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289 _
).Select

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default what object var should I use for the following code


You are stepping thru the code (F8), instead just let it run (F5).
Also, as Dave said, you many need to use objSB.Object to set some of the properties.
Jim Cone


"TONY"
wrote in message
When I try this I get the following Error message.
"Cant enter break mode at this time"



"Jim Cone" wrote:
Sub HowToDoIt()
Dim objSB As OLEObject
Dim cw As Long
cw = 20
Set objSB = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289)
objSB.Name = "Mush"
Set objSB = Nothing
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"TONY"
wrote in message
I recorded the following code for adding a scrollbar to a sheet.... no
problem. So I cut and paste the code into my module and it runs fine.
However what I can not figure out is what OBJECT varriable I can use with
this statement so I can use the object varriable in the WITH END WITH
cinstruct so I can reach and change different properties of the control.

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Scrol lBar.1", Link:=False, _
DisplayAsIcon:=False, Left:=cw * 5, Top:=7, Width:=15#, Height:=289 _
).Select

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
Delete object code Marie Bayes Excel Discussion (Misc queries) 1 April 29th 09 03:41 PM
Chart Object VB Code MS[_2_] Charts and Charting in Excel 2 March 6th 07 11:41 AM
Code to different object models Wboson Excel Programming 5 September 12th 05 11:25 AM
Programming code to new object Martin Excel Programming 12 August 9th 05 10:45 AM
HELP! Object specific Code dee Excel Programming 3 February 13th 05 07:16 PM


All times are GMT +1. The time now is 04:50 AM.

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"