toggle button size modified via vba

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
I'm 99% you can't make a toggle button using code, so can you change the size and location of one via code?

I have a few on a sheet and they seem to have resized/relocated on their own when switch computers and it's quite annoying so I was just going to have code (if possible) to ensure they don't do that again.

Thanks!
 
So why not use a On Open script:

In The Vba editor double click on Thisworkbook

And paste in this code:

Code:
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", False)"
End Sub
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
So why not use a On Open script:

In The Vba editor double click on Thisworkbook

And paste in this code:

Code:
Private Sub Workbook_Open()
Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"", False)"
End Sub

That was my first thought but when I tried it, it ended up applying to any activeworkbook which was a problem
 
Upvote 0
This script will only work on the Workbook you put this script in.
Except that (at least with excel 2010) two different workbooks share the same excel window....so you are endlessly switching from one to the other- it's not like opening, say, a second word document or google chrome window where it can be moved independent of the first....
 
Upvote 0
So really I should be tweaking this code for for differentiating between Excel 2013 and beyond versus some of the older machines running 2010
 
Upvote 0
I really do not have a answer.

I have never tried to have several workbooks open at the same time and have both of them visible and then tried to switch back from one to the other and try to do what your wanting.

 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,762
Members
449,048
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top