ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Visibility of a command Button (https://www.excelbanter.com/excel-programming/297648-visibility-command-button.html)

Al Bundy

Visibility of a command Button
 
Shouldn't be too hard. Check for the file and set your
conditions when the workbook opens using the workbook_open
event.

HTH... Al

-----Original Message-----
I don't think that what I am proposing to do is possible,

but it is worth a shot (and will make my boss happy which
is always a good thing). I want to be able to set a
condition for the visibility of a command button. I want
the button hidden unless there is a certain file in a
certian drive. I have yet to be given the specifics on
what the file will be and where it wil be, so for now I
will call the file "test.doc" and the
location "G:\Assets\". When "test.doc" is in "G:\Assets\"
I want CommandButton1 on Sheet1 to be visible.
When "test.doc" is NOT in "G:\Assets\" I want
CommandButton1 to NOT be visible.

Thanks for your help!

Ryan
.


ryan

Visibility of a command Button
 
Al

How do I do this

Ryan

Al Bundy

Visibility of a command Button
 
Post the code below to the Workbook module. Make sure you
have a CommandButton1 in Sheet1.

Private Sub Workbook_Open()

If Dir("G:\Assets\test.doc") = "" Then
Sheet1.CommandButton1.Visible = False
Else
Sheet1.CommandButton1.Visible = True
End If

End Sub

HTH... Al


-----Original Message-----
Al,

How do I do this?

Ryan
.



All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com