I am trying to make an order entry spreadsheet that will open a blank order form spreadsheet and copy information to it then save it as a file based on the customer name and today's date. I ran into a problem if the blank order form spreadsheet is already open it stops to ask if I want to reopen it and loose any changes.
I thought an open file check would be the best way to handle this and so I wrote
But every time i try to test this it comes up with the error "Sub or Function Not Defined" and highlights IsFileOpen("C:\JGM (MBA)\Blank Order Form.xlsx")
I have also tried
But it has the same error. I am not sure what is wrong but as always any help is appreciated.
I thought an open file check would be the best way to handle this and so I wrote
Code:
If IsFileOpen("C:\JGM (MBA)\Blank Order Form.xlsx") Then
Windows("Blank Order Form.xlsx").Activate
Range("A9").Select
ActiveSheet.Paste
Name = Range("B9").Value & Range("E9").Value
ChDir "C:\JGM (MBA)\Customer Orders"
ActiveWorkbook.SaveAs filename:=Name & Format(Date, "mmddyyyy") & ".xls"
Else
Workbooks.Open filename:= _
"C:\JGM (MBA)\Blank Order Form.xlsx"
Windows("Blank Order Form.xlsx").Activate
Range("A9").Select
ActiveSheet.Paste
Name = Range("B9").Value & Range("E9").Value
ChDir "C:\JGM (MBA)\Customer Orders"
ActiveWorkbook.SaveAs filename:=Name & Format(Date, "mmddyyyy") & ".xls"
End If
But every time i try to test this it comes up with the error "Sub or Function Not Defined" and highlights IsFileOpen("C:\JGM (MBA)\Blank Order Form.xlsx")
I have also tried
Code:
Blank = "C:\JGM (MBA)\Blank Order Form.xlsx"
If IsFileOpen("Blank") Then...
But it has the same error. I am not sure what is wrong but as always any help is appreciated.