explicitly name workbook and close without saving

L

laavista

This seems like such a simple thing, but I need help!

I have 3 workbooks open. I need to close one of them without saving, and I
want to name the specific workbook to close.

I've tried lots of things. The latest is:

dim wbName as workbook

wbName = ("MyFile.xls")
wbName.Close SaveChanges:=false

Your help would be GREATLY appreciated!
 
J

Joel

wbName = "MyFile.xls"
set wbk = workbooks(wbname)
wbk.Close SaveChanges:=false

or simply
workbooks("MyFile.xls").Close SaveChanges:=false
 
L

laavista

Joel, you are a genius!!

Thanks so much for taking the time to help me with this! I really do
appreciate it!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top