PDA

View Full Version : Using Shape to control spin button



Billbill
07-09-2022, 12:17 PM
Hi is anybody able to tell me how i can use shapes to control a spin button please, after hour & hours I am still unable to find out how this is done. I wish to hide the spin button and control the functions Up & Down using shapes but I dont know how to code this. Sorry for my lack of knowlegde. Thank you in advance.


Private Sub SpinButton1_Change()
Text.Value = SpinButton1.Value
End Sub

John Wilson
07-10-2022, 12:33 PM
To use a shape click to increase the value by e.g. 5


Sub UP()
Dim lngVal As Long
Dim osld As Slide
Set osld = SlideShowWindows(1).View.Slide
lngVal = osld.Shapes("SpinButton1").OLEFormat.Object.Value
osld.Shapes("SpinButton1").OLEFormat.Object.Value = lngVal + 5
End Sub

Billbill
07-10-2022, 03:14 PM
Hi John

Thanks a million for your reply this great work thank you, I have inserted your code and it works fine, I will be able to use this although, I was wondering if there is any way to make the numbers increase constantly like using the spin button. If there is not or it is too much coding, then please don’t worry. And once again thank you.

Billbill
07-10-2022, 03:14 PM
Private Sub spin_days_Change()
txt_days.Value = spin_days.Value
End Sub

Sub UP()
Dim lngVal As Long
Dim osld As Slide
Set osld = SlideShowWindows(1).View.Slide
lngVal = osld.Shapes("spin_days").OLEFormat.Object.Value
osld.Shapes("spin_days").OLEFormat.Object.Value = lngVal + 6
End Sub

Sub DOWN()
Dim lngVal As Long
Dim osld As Slide
Set osld = SlideShowWindows(1).View.Slide
lngVal = osld.Shapes("spin_days").OLEFormat.Object.Value
osld.Shapes("spin_days").OLEFormat.Object.Value = lngVal - 6
End Sub