Open then Close

  • Thread starter Thread starter Markus
  • Start date Start date
M

Markus

I want to open another existing workbook ("H:\control.xls")
and then close my current workbook ("listing.xls")with one
command button. Any suggestions?
Thanks
 
Private Sub CommandButton1_Click()
workbooks.open "H:\control.xls"
Workbooks("Listing.xls").close Savechanges:=False
End Sub
 
Sure. I do that all the time, but you have to write a
Visual Basic macro to do it.

Sub OpenClose()
Workbooks.Open FileName:="C:\)path).xls\"
Workbooks("thisworkbookname").Close SaveChanges:=True
End Sub

Having written that macro, now you can assign the macro
name to the button.
 

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

Back
Top