Hello,
Im not sure how to decalre a global public variable on a macro button I have! I need to declare it and set it to true! Anyone tell me how. This is the code im using.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If not fOK Then
MsgBox "Use the button you fool!"
Cancel = True
Else
fOK = false
End If
End Sub
----
Option Explicit
Sub SvMe() 'Save filename as value of A1 plus the current date
Dim newFile As String, fName As String
' Don't use "/" in date, invalid syntax
fName = Range("O2").Value
newFile = fName & ".xls"
' Change directory to suit
ChDir _
"C:\Documents and Settings\faboualfa\Desktop" 'YOU MUST Change USER NAME to suit
ActiveWorkbook.SaveAs Filename:=newFile
End Sub
Bookmarks