exclusive macros

O

Office_Novice

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
 
R

royUK

Depends on what your macro does, you can refer to objects in the
workbook by using ThisWorkBook, e.g.

Code:
--------------------

With ThisWorkbook
.Sheets(1).UsedRange.Copy .Sheets(2)
End With
--------------------


Or


Code:
 
F

Fan924

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

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
 
Top