View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Activating / Closing workbook using part name and a wild character

Hi Sharman,

Try something like:


Sub TestMe()
Dim WB As Workbook

For Each WB In Application.Workbooks
If LCase(Left(WB.Name, 3)) = "new" Then
WB.Close (False)
End If
Next
End Sub



---
Regards,
Norman



"sharman" wrote in message
...
Hi,

Is it possible to activate/close an open workbook by a macro by using
just
the part name alongwith with a wild character? Like if the workbook name
is
"NewBook_6_10" and I want to activate/close it by just using "New*". I
tried using it but I get an error message. Thanks in advance.