+ Reply to Thread
Results 1 to 6 of 6

Prevent new workbooks to open in same instance

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    molde
    MS-Off Ver
    Excel 2010
    Posts
    49

    Prevent new workbooks to open in same instance

    Hi
    I have a workbook that I want to allways be open in its own instance. It must prevent other workbooks to open in the same instance, and if other workbooks already is open, it must open it self in a new instance. Is there a code I can use to do what i want?



    Hope I explained my self well enough.

  2. #2
    Registered User
    Join Date
    05-11-2014
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Prevent new workbooks to open in same instance

    This code will open an excel file in a new instance in read only.

    Hope this helps

    Please Login or Register  to view this content.
    Dim objExcel
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    Set objWorkbook = objExcel.Workbooks.Open("YOUR FILE PATH HERE.xlsm ", ReadOnly:=True)
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-01-2012
    Location
    molde
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Prevent new workbooks to open in same instance

    Hi
    I tried the code, but it didn't work. It's a possibillity that I didn't do it right. Exactly where do I put the code? I placed it in "ThisWorkbook".


    Quote Originally Posted by brewsi View Post
    This code will open an excel file in a new instance in read only.

    Hope this helps

    Please Login or Register  to view this content.
    Dim objExcel
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    Set objWorkbook = objExcel.Workbooks.Open("YOUR FILE PATH HERE.xlsm ", ReadOnly:=True)
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Prevent new workbooks to open in same instance

    Quote Originally Posted by c00ly81 View Post
    Hi
    I tried the code, but it didn't work. It's a possibillity that I didn't do it right. Exactly where do I put the code? I placed it in "ThisWorkbook".
    Insert the new module put in the module as following......
    you can set a key for this macro or press F5

    Please Login or Register  to view this content.
    Lokesh Kumar
    Stay Hungry.. Stay Foolish..
    _________________________________________________________
    Please Click STAR to Add Reputation if my/someone's answer helped!

  5. #5
    Registered User
    Join Date
    10-01-2012
    Location
    molde
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Prevent new workbooks to open in same instance

    Doesn't work...

  6. #6
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Prevent new workbooks to open in same instance

    Hey Sorry,

    I have not tried that one....just thought that would be right....
    Use this......
    Please Login or Register  to view this content.
    Working on my system....
    If your question is resolved, mark it SOLVED using the thread tools. Click on the star if you think some-1 helped you.

+ 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] Force all workbooks into a single instance of Excel always?
    By ks100 in forum Excel General
    Replies: 3
    Last Post: 01-08-2014, 03:30 PM
  2. How to open workbooks in same instance of Excel 2007
    By sumdumgai in forum Excel General
    Replies: 5
    Last Post: 11-13-2013, 04:22 PM
  3. Replies: 2
    Last Post: 06-21-2012, 09:26 AM
  4. One instance using multiple workbooks
    By pasjr1972 in forum Excel General
    Replies: 1
    Last Post: 07-26-2009, 07:01 PM
  5. [SOLVED] How do i open a new instance Excel?
    By Michael D. Reed in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-03-2005, 03:05 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