Hi,
I would like to make a command button invisible, and to change its colour. I have Googled but cannot find out how to do this - button1.visible=false returns an "Object required" error message - any ideas?
Cheers,
Lotte
Hi,
I would like to make a command button invisible, and to change its colour. I have Googled but cannot find out how to do this - button1.visible=false returns an "Object required" error message - any ideas?
Cheers,
Lotte
Hi
Assuming that the commandbutton name is button1 then try
![]()
Please Login or Register to view this content.
HTH
rylo
Hi Rylo,
Thanks for the reply. The code you suggested returns the following error:
"Object doesn't support this property or method". Hmm. I'm using MS VB 6.3. Any ideas?
Lotte
Hi
What is the name of the button, and are you on the sheet with the button when you run the code?
rylo
Hi,
Yes, the active sheet contains the button. The code is:
![]()
Please Login or Register to view this content.
Lotte
Last edited by VBA Noob; 09-24-2007 at 04:27 AM.
Well, you could try from the drawing toolbar, just create a rectangle and change the line properties to "no line", then asign a macro to it. Then just change the color of it as the same color of your background to make it appear invisible.
Hi
Can you attach a copy of the spreadsheet, removing any sensitive data, and retain any relevant code.
rylo
Hi rylo,
It seems I cannot attach excel sheets to posts to this forum...?
Lotte
You have 2 ways of attachment..
either zip the file (right click it and choose zip ) then upload this or add the extension .txt
Thanks. See attached. The offending command is in the StartNewQaSession_Click() sub.
Lotte
Hi
The button with the caption Start New QA Session is acutally Button 17. So the line
should get you there.![]()
Please Login or Register to view this content.
rylo
rylo,
That worked - thanks very much!
Lotte
How can I display the name of the control? I've been creating a macro and looking at the name suggested by VBA - there must be a better way...?
Lotte
On the worksheet itself, double-click on the command button and it will show you the codes right.(make sure u under the design mode)
Right after that, u click on 'Properties Window'. And there under the properties for command button, under caption, you rename the name of the control aites!
that's all.
if its not clear, do tag back.
~~~~~~~~~~
lily
Hi
As you have used the command button from the forms menu, not the control toolbox menu, things are a bit more complicated.
If you have the spreadsheet open, and the VBE open and show the immediate window.
Hold down the control key, then select the button.
Then go to the immeditate window and type in the command
?activesheet.shapes.count
Then you can go through the shapes and select them until you manage to select the shape you want to examine
activesheet.shapes(1).select (increase the number)
Once you have determined the relevant shape number you can type in
?activesheet.shapes(i).name (where i is the relevant shape number).
That will give you the shape name.
Things would be much easier if you selected the button from the control toolbox. Can put code directly into the button event, and you can use the properties as well.
rylo
rylo,
Thanks very much.
Lotte
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks