Robb or anyone, macro button question
Posted by RoB on August 22, 2001 1:28 PM
Ok, I have code from you guys which works great. Its a macro that saves the file as a specific name. I also put in a piece of code to hide the button after the macro was executed (as i only wanted the button pressed once). This worked good, but I found that when i close the file and open it again, the button re-appears. Is there a way around this?
Thanks, heres the code of the whole page:
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("AL8")
LoanOfficer = Range("F4")
MyName = "S:\FileServer\Excel\Save FILES In Here\YEAR " & YRL & "\" & MM & "-" & Yr & "\" & (LoanOfficer) & "\" & (Borrower) & ".xls"
MsgBox ("File Saved As: " & MyName)
Application.ActiveWorkbook.SaveCopyAs (MyName)
Sheets("Application").PrintOut
Worksheets("Prelim Info").Shapes("SAVEBUTTON").Visible = False
End Sub