In excel, is there a way to have a radio button change a displayed PDF?
Like if this radio (option) button is selected then change the displayed PDF to another PDF.
Seems like a possible thing so asking here :D
Edit 1: a better example
Like in Excel you can insert a PDF, yeah. I want to change the PDF based off what radio button that is selected.
So let's say I want radio button 2's PDF but it's currently on RB1. So I'd select RB2 and it will change the current PDF, RB1's, to RB2's PDF.
Posted Nov 4, 2019, 3:16 AM UTC · edited
If the pdf object you've inserted has the visibility property then you could have a Boolean switch on click on the radio button on click to change the visibility of both files
eg:
Not 100% sure of the syntax as I'm typing this on my phone not a computer (it might be that you set visible to true/false).
You would
Okay, I'll try that. Thank you
So I thought this would be easy to understand where to put this code. Thought it was just in the developer tab and click on Visual Basic. I typed up this code with the names changed and its making a module, is this right? I havent messed around with Excel so I dont know.
Only reason I thought I could do this was because I took a class on Visual Basic and I understood that, no problem. Excel seems like a different breed of VBA lol
Hey so I finally got to a computer and my code was waaaay off.
As the poster below me noted, you have to create a radio button using the activeX controls, and assign a variable to its state.
In this case, my radio button is called "OptionButton1". You can find out what it is by right clicking on it and seeing what it's named in the top right corner.
Then, with your two PDF files inserted as objects, you can see what they're named (in this example, Object1 and 2 respectively).
All of this is taking place on the sheet called 'Test'.
I've confirmed that this example works based on what you described and a test (although I might suggest you use a tick box instead of a radio button since you may want it to be reversible, but that's your design choice and the same principles apply).
Hopefully the below makes sense!
Solution Verified
You have awarded 1 point to allmappedout
^I ^am ^a ^bot, ^please ^contact ^the ^mods ^for ^any ^questions.
Hmm I just tried inputing it into my sheet and I cant figure out how to click on the button haha Like I can move it, select it but I cant actually activate it. Gosh, Excel is hard xD Never worked with excel before so, learning experience, I guess.
Haha just tried again with a few modifications and it worked. Thanks for the help :D
No problems!
If you could mark it at solved that'd be awesome!
You have to create the radio button object first. Do that via the Developer ribbon, Insert Control icon, then select the control(s) you want to plop onto your sheet.