View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mr Bunj[_2_] Mr Bunj[_2_] is offline
external usenet poster
 
Posts: 3
Default Code to close and reopen file

Does the macro stop running when the file is closed?

If so how would it know to open itself again?


"Joel" wrote:


FName = "C:\temp\book1.xls""

''open workbook the 1st time
set oldbk = workbooks.open(filename:=FName)

'close file without making any changes
oldbk.close savechanges:=false

'open file a second time
set oldbk = workbooks.open(filename:=FName)


"Mr Bunj" wrote:

Looking to have a bit of code that will close the file it works on without
saving it and then reopen the same file.

I have a file (template.xls) which has a macro which runs on opening. Users
can then manipulate data and save the results to a given file. Without having
to blank all of the areas used for the data manipulation is there a way of
closing the template.xls file and then reopening it?