Thread: Disable Events
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_8_] Nigel[_8_] is offline
external usenet poster
 
Posts: 172
Default Disable Events

I suspect it is the case of the filename versus the test you are using.

Try changing the 2nd line to read

If UCase(ThisWorkbook.Name) = "MARKETING.XLS" Then

Cheers
N

"wiwi" wrote in message
...
I have a workbook ("Marketing.xls") and contain a macro as below. When I
save as the file to another name, I want to disable the macro. Please
help ... my macro won't work


Private Sub Workbook_Open()

If ThisWorkbook.Name = "Marketing.XLS" Then
For Each ws In Worksheets
If ws.Name Like "Costing (2)" Or ws.Name Like "T&A (2)" Or
ws.Name Like "Order Confirmations (2)" Then
ws.Delete
End If
Next ws
End If
End Sub


---
Message posted from http://www.ExcelForum.com/





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---