Hiding Buttons in Macro
Posted by RoB on August 17, 2001 2:21 PM
I'm still having the error "Object does not support this property or method" when I execute my code to hide a button. The sheet the button is on is called "Application" and I named the button by using the name box "SAVEBUTTON". Here is the code Robb gave me, but I cant seem to get it to work. (By the way Robb, I tried using Me, it said "Invalid use of Me keywork"...what exactly is "Me"?)
here is the whole page of code I use. The applicable part is in bold:
Sub SaveMacro()
Mo = Month(Now())
If Mo = 0 Then
Mo = 12
Yr = Format(Now(), "YY")
YRL = Format(Now(), "YYYY")
Else
Yr = Format(Now(), "YY")
YRL = Format(Now(), "YYYY")
End If
Select Case Mo
Case 1
MM = "01"
Case 2
MM = "02"
Case 3
MM = "03"
Case 4
MM = "04"
Case 5
MM = "05"
Case 6
MM = "06"
Case 7
MM = "07"
Case 8
MM = "08"
Case 9
MM = "09"
Case 10
MM = "10"
Case 11
MM = "11"
Case 12
MM = "12"
End Select
Borrower = Range("E10")
MyName = "S:\FileServer\Excel\Save FILES In Here\YEAR " & YRL & "\" & MM & "-" & Yr & "\" & (Borrower) & ".xls"
MsgBox ("File Saved As: " & MyName)
'Application.ActiveWorkbook.SaveCopyAs (MyName)
Worksheets("Application").SAVEBUTTON.Enable = False
Worksheets("Application").SAVEBUTTON.Visible = False
End Sub