Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Command Button Hide (Excel 2000)

    Good Morning....

    OK I know I've been a pest lately...but I promise this should be the last question......(I hope any way)

    When the user opens the template, makes the changes, and proceeds to close it, the template automatically saves it as a .xls with a predefined name. No problem.

    However, when the user opens the .xls I want certain buttons to NOT be visible the WERE visible in the .xlt.

    I have the following but it doesn't work, can someone please suggest as to why:

    Private Sub Workbook_Open()
    Dim Filename As String
    Dim strXLSFileName

    strXLSFileName = ThisWorkbook.Worksheets("PatientInfo").Range("G1") & Format(Date, "yyyymmdd") & ThisWorkbook.Worksheets("PatientInfo").Range("H1") & ".xls"

    Filename = strXLSFileName

    If ActiveWorkbook.Name = Filename Then
    Sheets("AssessmentFU").CommandButton1.Enabled = False
    Sheets("PatientInfo").CommandButton1.Enabled = False
    Sheets("SendMailer").CommandButton3.Enabled = False
    End Sub

    Once again, thanks in advance.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Command Button Hide (Excel 2000)

    Try something like this:

    Private Sub Workbook_Open()
    Dim fNew As Boolean
    fNew = (InStr(ThisWorkbook.FullName, "") = 0)
    Sheets("AssessmentFU").CommandButton1.Visible = fNew
    Sheets("PatientInfo").CommandButton1.Visible = fNew
    Sheets("SendMailer").CommandButton3.Visible = fNew
    End Sub

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command Button Hide (Excel 2000)

    As always Hans....worked like a charm!!!!

    Thanks.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •