O Office_Novice Dec 9, 2008 #2 You Could Try somthing like... Function IsWorkbook() As Boolean IsWorkbook = ActiveWorkbook.Name = ("Book2") End Function Sub Test() If IsWorkbook = True Then MsgBox "Your Macro Here" Else MsgBox "Sorry no Macro for you" End If End Sub
You Could Try somthing like... Function IsWorkbook() As Boolean IsWorkbook = ActiveWorkbook.Name = ("Book2") End Function Sub Test() If IsWorkbook = True Then MsgBox "Your Macro Here" Else MsgBox "Sorry no Macro for you" End If End Sub
F Fan924 Dec 10, 2008 #4 Function IsWorkbook() As Boolean IsWorkbook = ActiveWorkbook.Name = ("Book2") End Function Sub Test() If IsWorkbook = True Then MsgBox "Your Macro Here" Else MsgBox "Sorry no Macro for you" End If End Sub Click to expand... I could not get this to work, Thanks to Chip Pearson's timely post, I made a few changes to it and it worked. If ThisWorkbook.FullName = ActiveWorkbook.FullName Then MsgBox "Your Macro Here" Else MsgBox "Sorry no Macro for you" End If
Function IsWorkbook() As Boolean IsWorkbook = ActiveWorkbook.Name = ("Book2") End Function Sub Test() If IsWorkbook = True Then MsgBox "Your Macro Here" Else MsgBox "Sorry no Macro for you" End If End Sub Click to expand... I could not get this to work, Thanks to Chip Pearson's timely post, I made a few changes to it and it worked. If ThisWorkbook.FullName = ActiveWorkbook.FullName Then MsgBox "Your Macro Here" Else MsgBox "Sorry no Macro for you" End If