IsFileOpen - Sub or function not defined error

furstukin

Board Regular
Joined
Apr 22, 2011
Messages
71
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

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.
 
That is VB.Net code and not VBA so it will not work in Excel.
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top