?
Solved

Identifying a file being open.

Posted on 2014-11-12
4
Medium Priority
?
109 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 36

Accepted Solution

by:
Kimputer earned 2000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

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,…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

770 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