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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

708 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

18 Experts available now in Live!

Get 1:1 Help Now