+ Reply to Thread
Results 1 to 8 of 8

Click the button and open the file in a separate Excel window

  1. #1
    Registered User
    Join Date
    11-26-2013
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    20

    Click the button and open the file in a separate Excel window

    Hi, guys.

    My sheet has some buttons, they all open a new workbook. It's the same workbook for all the buttons, but each one has a hyperlink to a different named range in this workbook.

    The problem is the workbook asked to open does it in the same window. I need something to open it in a separate window so that I can view the current file and the new file separatedly.

    I tried running some macros I found searching the web, linking the buttons to them, but none of them worked.

    Any help? Thank you so much.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Click the button and open the file in a separate Excel window

    Hi Lewis,

    The Macro 'Select_File_Or_Files_Windows()' at the following link works for me using Vista 32 bit system and Excel 2003.
    http://msdn.microsoft.com/en-us/libr...ice.14%29.aspx

    Lewis (M)

    Retraction. I was misinformed. The code referenced here opens an Excel file in the SAME instance of Excel.
    Last edited by LJMetzger; 02-03-2014 at 03:58 PM. Reason: Added Retraction.

  3. #3
    Registered User
    Join Date
    11-26-2013
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Click the button and open the file in a separate Excel window

    Quote Originally Posted by LJMetzger View Post
    Hi Lewis,

    The Macro 'Select_File_Or_Files_Windows()' at the following link works for me using Vista 32 bit system and Excel 2003.
    http://msdn.microsoft.com/en-us/libr...ice.14%29.aspx

    Lewis (M)
    Hi, LJMetzger! Thank you for replying!

    This macro is fine, but it's not what I'm looking for. Maybe I'm quite ambiguous about my issue, sorry. :P

    This macro prompts a window to select a file. I don't want that, I want a macro which will open a new workbook, a specified file, in a new window.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Click the button and open the file in a separate Excel window

    Hi again,

    It's just as well that my previous post didn't suit your needs, because I was wrong - see retraction above.

    However, I did find the following code, that does work (Vista 32 bit using Excel 2003) courtesy of Andy Pope circa 2003. Thanks again Andy.

    Lewis

    Change to path and file name below to suit your needs.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-26-2013
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Click the button and open the file in a separate Excel window

    Hi, LJMetzger, thank you so much, 90% is done! :D

    I just need something else in the code which allows me to reference the named range I want to open.

    Currently, with the code you sent, I defined sPath and sFileName.

    sPath = "\\Servidor\adm\BH\BASEDADOS" & "\"
    sFileName = "DadosProdutos.xlsm"

    That's right. It works and opens the file in a separate window. But I need it to open from a named range.

    With hyperlinks, I can use:

    \\Servidor\adm\BH\BASEDADOS\DadosProdutos.xlsm#Range1
    \\Servidor\adm\BH\BASEDADOS\DadosProdutos.xlsm#Range2
    \\Servidor\adm\BH\BASEDADOS\DadosProdutos.xlsm#Range3

    I need something in VBA which can do something similar.

    I tried:

    sFileName = "DadosProdutos.xlsm#Range1"

    But of course it doesn't work, 'cause the code reads everything inside "" as the file name.
    Last edited by LewisM; 02-04-2014 at 07:21 AM.

  6. #6
    Registered User
    Join Date
    11-26-2013
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Click the button and open the file in a separate Excel window

    I believe this is not a hard thing to do. It's cause as I am not an expert in VBA, I don't know how to proceed.

    I think I'd need something like 'sPath', or 'sFileName' to define my Range. Something like 'sRange' (?). I just don't know how it is called. In case someone knows, e-mail me ([email protected]) or send me a PM, I will thank you forever.

    But, as no one seems to have the answer, I'm marking this thread as solved, since the big problem doesn't exist anymore. I can open my workbook in a separate window.

    I am going to delete the 10 buttons I have and replace them for one button only which will open the second workbook in a separate window.

    I will add 10 buttons to this second workbook and I will hyperlink them to their ranges.

    Thank you so much for your help, LJMetzger (just added rep to you, thanks), and thanks to Andy Pope too, for your courtesy.

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Click the button and open the file in a separate Excel window

    Hi Lewis,

    Every time I post to you, it feels like I'm talking to myself.

    I was able to create a pseudo-hyperlink to an Excel file in an separate instance of Excel if the destination file is 'Macro Enabled' and has a special macro in the 'Workbook_Open' module. I did this by creating a 'scratch' Excel file that is written to by the calling 'Excel File' and read by the destination 'Excel file'. I attached two workbooks and the code follows here.

    Lewis

    Workbook_Open() in the Destination File:
    Please Login or Register  to view this content.

    Example Code for the Buttons in the Calling Excel file:
    Please Login or Register  to view this content.

    Code that does the work in the calling Excel file:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-26-2013
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Click the button and open the file in a separate Excel window

    Thank you so much, this is awesome!

+ 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. [SOLVED] open a message window when excel file is opened with a function button
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-03-2013, 09:26 AM
  2. Replies: 2
    Last Post: 04-12-2013, 07:56 PM
  3. How to open excel documents in separate window
    By mcride in forum Excel General
    Replies: 2
    Last Post: 06-22-2012, 04:18 PM
  4. Open a Help window if click on a button
    By royinfo in forum Excel General
    Replies: 3
    Last Post: 11-19-2009, 03:55 PM
  5. [SOLVED] Cancel Button in Open File Window
    By SS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2005, 02:37 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