+ Reply to Thread
Results 1 to 4 of 4

Macro to open workbook with a suffix (need help to check if file is already open)

  1. #1
    Registered User
    Join Date
    12-16-2008
    Location
    Blackpool, UK
    MS-Off Ver
    2003, 2007, 2010
    Posts
    54

    Macro to open workbook with a suffix (need help to check if file is already open)

    Good Afternoon all,

    I am using a small macro within a macro to open a file, the below code opens said file with a suffix to differentiate the file from any others in the folder very useful for adding a date etc.. I need some help finding a way to check if the file is already open before trying to open it again with a macro, I have fond a couple of vba code posts which check if a specific filename is open but none to help with a variable suffix. only one file would be open with the prefix "Planning Tool" at any one time and i was thinking to try and check for something like "Planning Tool*" and if it is open to activate the workbook and not open it again. Any help with an addition to the below code would be very much appreciated, I am a novice at VBA and can not find what i am specifically looking for on the forums, Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to open workbook with a suffix (need help to check if file is already open)

    Maybe something like this...

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 08-24-2017 at 10:44 AM. Reason: Typo
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    12-16-2008
    Location
    Blackpool, UK
    MS-Off Ver
    2003, 2007, 2010
    Posts
    54

    Re: Macro to open workbook with a suffix (need help to check if file is already open)

    Thank you AlphaFrog, you got me there, I just had to tweek the code a little to get it to work as expected.

    Please Login or Register  to view this content.
    Thanks a Million

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to open workbook with a suffix (need help to check if file is already open)

    You're welcome. As best i can tell, your tweaks are superfluous. I had a spelling error in one of the Like statements which I later corrected. Perhaps you got the code and made your tweaks before I corrected the typo. Either way, as long as it works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Check if a Word File is Open and If Open Close it with Excel VBA.
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-10-2012, 11:14 AM
  2. Macro to check for newer version on workbook open
    By leonnafaye in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-15-2012, 04:27 PM
  3. Check if file is open and open if closed
    By Jockster in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-22-2010, 08:18 AM
  4. Check if workbook is the only Excel File Open
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-17-2009, 12:09 PM
  5. Check to see if file is open, and if it is open, activate it
    By karen000 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2009, 03:59 AM
  6. Macro to check if the file is open
    By hunsnowboarder in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-15-2008, 05:05 AM
  7. Required - macro to check whether the file is open
    By gloring in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2008, 04:44 AM
  8. vba to check presence of file and open/not open
    By fLiPMoD£ in forum Excel General
    Replies: 2
    Last Post: 04-28-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1