Auto close read-only, question boxes?

  • Thread starter Thread starter sefus12
  • Start date Start date
S

sefus12

I'm new to VB and I've written a macro that opens a second spreadsheet,
pulls data, and then closes the spreadsheet. What kind of code can I
put in the macro to automatically choose the "read only" option when
opening the spreadsheet and then automatically not save changes made to
the spreadsheet and automatically not save the data on the clipboard to
use later? Any help would be appreciated. Thanks all.
 
dim wkbk as workbook

set wkbk = workbooks.open(filename:="C:\yourfilename.xls", readonly:=true)
'do a bunch of work

wkbk.close savechanges:=false

You'll see a lot of options you can specify in the .Open line when you look at
VBA's help.
 

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