Hi - here is part of the code that I am using. When I have run my complete macro this file that I select as per the code below always remains open when I am done using the macro to perform its task. Can someone help me with a bit of code that could put at the end of macro to ensure all files are closed when procedure has been completed ?
Many thanks
MFile = ActiveWorkbook.Name Application.ScreenUpdating = False proceed: WeeklyFN = Application.GetOpenFilename(fileFilter:="All files (*.*), *.*", Title:="Please open the GT Feed") If WeeklyFN = "" Then MsgBox "You have not selected a file." GoTo proceed Else Workbooks.Open Filename:=WeeklyFN WeeklyFN = ActiveWorkbook.Name End If
Dim WeeklyFNBook as Workbook MFile = ActiveWorkbook.Name Application.ScreenUpdating = False proceed: WeeklyFN = Application.GetOpenFilename(fileFilter:="All files (*.*), *.*", Title:="Please open the GT Feed") If WeeklyFN = "" Then MsgBox "You have not selected a file." GoTo proceed Else Set WeeklyFNBook = Workbooks.Open Filename:=WeeklyFN:Rem Changed <<<<<<<<<<<<<<<<< WeeklyFN = WeeklyFNBook.Name: Rem changed <<<< End If Rem do stuff WeeklyFNBook.Close
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks