1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel Macro to open a workbook

Discussion in 'Business Applications' started by PincivMa, Jul 8, 2011.

Thread Status:
Not open for further replies.
  1. PincivMa

    PincivMa Thread Starter

    Joined:
    Mar 13, 2004
    Messages:
    378
    Hi There

    I have recorded a macro that opens up a workbook from my C drive as follows:

    Workbooks.Open Filename:= _
    "C:\Documents and Settings\Mario Pincivero\My Documents\Homes\Salem's Point 1L 40M-2423.xls"

    I also recorded a macro that opens a workbook from windows as follows:

    Windows("Salem's Point 1L 40M-2423.xls").Activate

    I want to combine these two macros to do the following:

    If Salem's Point 1L 40M-2423.xls is aready open then do the code Windows("Salem's Point 1L 40M-2423.xls").Activate

    If Salem's Point 1L 40M-2423.xls is not open then do the code Workbooks.Open Filename:= _
    "C:\Documents and Settings\Mario Pincivero\My Documents\Homes\Salem's Point 1L 40M-2423.xls"

    Please help

    Mario
     
  2. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,581
    First Name:
    Hans
    Hi Mario,

    When you say you open a workbook from your C-drive.
    Are you executing your macro from within an Excel workbook or how?
    What do you trigeer it with or where do you trigger it from?
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1006369

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice