Is htere a way to make an if then statement liike
If this macro is activated from a button then disable this private sub in the workbook module? then when the macro is done it re enables it
Is htere a way to make an if then statement liike
If this macro is activated from a button then disable this private sub in the workbook module? then when the macro is done it re enables it
You can use Application.Caller to determine if a routine has been called as the result of a button click.
It would be easier to use that to branch around calling the sub rather than disabling the sub.
![]()
If TypeName(Application.Caller) <> "String" Then Call theMacro End If
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
That work excepts the code in the workbook is to disable the save function.. And the macro i'm calling is to save something.. see its like.. you can't go to file menu save and save as.. only if you click the save "button" in the sheet.. if that makes sense.. then the macro saves it to a certain location.. not where somebody wants to save it
Are you using the before save event?
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Yes I Am.. its like
except that crashes the workbook i need something like that though where save and save as is disabled.. but u can push a button and it will save to a certain directory![]()
Private Sub Workbook_BeforeSave(ByVal SaveUI As Boolean, Cancel As Boolean) If Sheets("Sheet1").Select & Range("A5").Value > 0 Then ActiveWorkbook.SaveAs Filename:="C:\Users\Hunter\Documents\" & Range("A1").Value, _ FileFormat:=xlOpenXMLWorkbookMacroEnabled, _ CreateBackup:=False ElseIf Sheets("Sheet1").Select & Range("A5").Value = 0 Then Cancel = True MsgBox "Uh uh" End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks