Solved

Identifying a file being open.

Posted on 2014-11-12
4
104 Views
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

Windows(FileLookingFor).Activate
If Err.Number = 0 Then
        isOpen = True
        MsgBox ("Yes it is open, use a Goto command to move to proper place in the macro.")
Else
    isOpen = False
    MsgBox ("Nope, not open")
    Workbooks.Open Filename:="C:\_SAP\Extract\SIF_CreatorPlus.xlsm", ReadOnly:=True
    Windows("SIF_CreatorPlus.xlsm").Activate
    Sheets("MasterCopy").Select
    '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

0
Comment
Question by:RWayneH
  • 3
4 Comments
 
LVL 35

Accepted Solution

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

Author Comment

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

Author Comment

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

Author Closing Comment

by:RWayneH
ID: 40438212
Still get the pts... Thanks for the helps
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 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