Results 1 to 5 of 5

How to Declare a global public variable on Macro Button

Threaded View

  1. #1
    Registered User
    Join Date
    08-05-2007
    Posts
    11

    How to Declare a global public variable on Macro Button

    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
    Last edited by VBA Noob; 08-06-2007 at 06:01 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1