Results 1 to 7 of 7
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    Access VBA to know if an excel file (not an existed file from a directory) is open ?


    Is there Access VBA code to know if an excel file (not an existing file from a directory) is open ?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You mean you are trying to determine if code to open a new workbook file was successful? Not sure how else there could be an open file that wasn't opened from a directory, but just trying to be sure of your meaning. Attempting to effect an action on the file (such as saving it) or testing a property of the file, or testing if the object variable for the file Is Nothing might be ways you could know.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    nope, not a code to open a file if is successful.
    If a file is open while the program is running, the person could open excel or power point or words (not necessarily an existing file from a directory - but just a new file) and then run a program. Because of the file being open it affects the program. I want the program to detect that a file is open and let the user know before it runs the program so it doesn't create error messages.

    In excel VBA it just loops all the excel file that is open regardless of it's newly open or from a directory and detect the name and how many excel file is open. Can access VBA do this ?

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Sorry, but you're still unclear. Is a "file" an Access database, or is "the program" an Access database? Or is a "file" an output of a "program" like a document from Word, or a workbook from Excel? If I'm not opening a file from a directory, then I have to open a program that creates such a file first before I can create a new file. Thus
    ...person could open excel ... and then run a program.
    If you know how to open Word without opening an existing file and not execute Word.exe either, then that's news to me.

    In excel VBA it just loops all the excel file that is open regardless of it's newly open or from a directory and detect the name and how many excel file is open. Can access VBA do this ?
    If you're saying that Excel vba can do what you want, then yes, Access vba is similar enough in that respect. As far as I know, the newly opened file must be saved already, otherwise it's just a temp file and may not even exist outside of memory.

  5. #5
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    The program and the file open is separate (the file is not the program). The file could be open, let's just say excel because this is mostly referring to excel anyway because the program is working with excel file, and then the program run. I just want the program to detect that an excel file is open and so then stop the program and tell the user to close the excel file to run the program.
    I know how to detect an excel file that already exist in a directory if it's open. This is mostly referring to newly excel file that is open and not save at all. Excel VBA can do this, I don't know if Access VBA could. It doesn't seem like it.

    Hope that makes sense.

  6. #6
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    program is an access database, the file is excel. file is not an output of the program, file is just a random file being open but the program does open other existing excel files from the directory. The issue is that the opened file from the directory by the program is causing conflict with an already open excel file (not open from directory but newly open). Hope that makes sense.

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-15-2015, 10:09 AM
  2. Open file from current Directory
    By mathanraj76 in forum Programming
    Replies: 3
    Last Post: 11-26-2013, 10:35 PM
  3. Replies: 5
    Last Post: 10-15-2012, 11:10 PM
  4. Open Excel .xlsx file from Access
    By Bigmix in forum Programming
    Replies: 6
    Last Post: 02-28-2012, 09:55 AM
  5. Open excel file in access
    By shanky365 in forum Access
    Replies: 1
    Last Post: 09-11-2011, 03:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums