Solved

Identifying a file being open.

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
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 in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

726 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