Identifying a file being open.

Posted on 2014-11-12
Last Modified: 2014-11-12
Why does the follow not identify the file being open?

'Is the SIF_FileCreatorPlus open? If not open, if opened continue.
'Loop through catcode in this file.
Dim OrderFileName As String, isOpen As Boolean
FileLookingFor = "SIF_FileCreatorPlus.xlm [Read-Only]"

On Error Resume Next  '<<turn on error trap
isOpen = False

If Err.Number = 0 Then
        isOpen = True
        MsgBox ("Yes it is open, use a Goto command to move to proper place in the macro.")
    isOpen = False
    MsgBox ("Nope, not open")
    Workbooks.Open Filename:="C:\_SAP\Extract\SIF_CreatorPlus.xlsm", ReadOnly:=True
    'Start with active cell C2 and move down list
    Range("C2").Select  'Position to collect catcodes
End If
On Error GoTo 0  '<<turn off error trap

Open in new window

Question by:RWayneH
  • 3
LVL 35

Accepted Solution

Kimputer earned 500 total points
ID: 40438086
Try changing
FileLookingFor = "SIF_FileCreatorPlus.xlm [Read-Only]"
FileLookingFor = "SIF_FileCreatorPlus.xlsm [Read-Only]"

Author Comment

ID: 40438186
Nope this did not work.  I also removed the [Read-Only] too.  No luck.  Any other ideas?

Author Comment

ID: 40438210
Duh..  I had the filename wrg...  It is working correctly...

Author Closing Comment

ID: 40438212
Still get the pts... Thanks for the helps

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Introduction This Article is a follow-up to my Mappit! Addin Article (, it was inspired by an email posting I made to EUSPRIG (, I will briefly cover: 1) An overvie…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now