muhleebbin
Active Member
- Joined
- Sep 30, 2017
- Messages
- 252
- Office Version
- 365
- 2019
- 2016
- 2013
- 2010
- Platform
- Windows
- MacOS
- Mobile
- Web
Hi,
I have the following code where it opens a file and then copies sheets etc.:
Because Scheduler Reports v2 will not be created until later in the month, can someone help with the code to exit this macro if the file is not there but if it is continue on?
I tried this thread but couldn't seem to get it to work
Thank you in advance for your assistance!
I have the following code where it opens a file and then copies sheets etc.:
VBA Code:
Sub CopyComparison()
Application.DisplayAlerts = False
Dim filename As String
filename = ThisWorkbook.Path & Application.PathSeparator & "Scheduler_Reports v2.xlsx"
Dim wk As Workbook
Set wk = Workbooks.Open(filename, ReadOnly:=True)
'code
End Sub
Because Scheduler Reports v2 will not be created until later in the month, can someone help with the code to exit this macro if the file is not there but if it is continue on?
I tried this thread but couldn't seem to get it to work
if file does not exist then exit VB
Hi, I have a peice of code which opens up to ten work books and manipulates data. What i need is a piece of code to put at the start which will check for the existance of each file BEFORE the rest of the code executes, if it does not exist it need to error message and exit the code at that...
www.mrexcel.com
Thank you in advance for your assistance!