+ Reply to Thread
Results 1 to 10 of 10

VBA code to create separate Excel instance and hide application

  1. #1
    Registered User
    Join Date
    10-16-2018
    Location
    Cape Town, South Africa
    MS-Off Ver
    Office 365
    Posts
    9

    VBA code to create separate Excel instance and hide application

    Hi All,

    I'm looking for a way to open my workbook in a separate instance of Excel and then hide the application and show only a userform called Client_Information_UF.

    After searching around I found this bit of code to create a separate instance of Excel, but if I change xlApp.Visible = True to xlApp.Visible = False, the application and workbook still shows behind the userform when opening. Not sure why, i thought the False statement would hide the application?

    Private Sub Workbook_Open()

    Dim xlApp As Excel.Application
    Set xlApp = New Excel.Application
    xlApp.Visible = True
    Set xlApp = Nothing
    Client_Information_UF.Show

    End Sub


    I need the application of this particular instance of Excel to hide only. If i was to use for e.g. a shared instance of Excel and use code like Application.Visible = False somewhere in my Sub, then it hides any other workbooks that the user may have open when I open this workbook.

    Hope my question is clear and forgive me if its a really obvious solution. I'm really new to VB.

    Thanks in advance

    Patrick

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,280

    Re: VBA code to create separate Excel instance and hide application

    Although you are opening a new Excel instance, you aren't actually loading your workbook in it, which is why you can still see the application. Why do you want to hide the application if you still want the user to be able to see other open workbooks?
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    10-16-2018
    Location
    Cape Town, South Africa
    MS-Off Ver
    Office 365
    Posts
    9

    Re: VBA code to create separate Excel instance and hide application

    Thanks for the speedy reply Rory. I had this bit of code in as well but all it did was create a blank workbook behind my userform, so i took it out.

    xlApp.Workbooks.Add

    The reason i want to hide one application and keep another open is because my userform is an insurance quoting platform, and users quoting on that will often be getting the data from another Excel workbook that has been giving to them.
    So i'd like them to be able to open their workbook as normal, but when opening mine, only see the quoting platform as a userform.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,280

    Re: VBA code to create separate Excel instance and hide application

    Why don't you just hide yours through the UI then (Window - Hide), or make it into an add-in, which it sounds like it ought to be?

    Also, you should note that the same cross-posting rules apply here as at MrExcel.

  5. #5
    Registered User
    Join Date
    10-16-2018
    Location
    Cape Town, South Africa
    MS-Off Ver
    Office 365
    Posts
    9

    Re: VBA code to create separate Excel instance and hide application

    My apologies. Noted on the cross posting...

    What code would I use to do as you suggested?

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,280

    Re: VBA code to create separate Excel instance and hide application

    You don't need code. Just hide the workbook and save it.

  7. #7
    Registered User
    Join Date
    10-16-2018
    Location
    Cape Town, South Africa
    MS-Off Ver
    Office 365
    Posts
    9

    Re: VBA code to create separate Excel instance and hide application

    But I'm not the one who is going to use the quoting userform. Its being rolled out to other users. They wont know to do that hence why i want code to do this automatically when the workbook is opened.
    I need just the userform to display when opening my workbook, but not not to close any other workbooks that the user may have open, or open.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,280

    Re: VBA code to create separate Excel instance and hide application

    Once you've saved it that way, it will remain that way for anyone who opens it. The user doesn't have to hide it each time.

  9. #9
    Registered User
    Join Date
    10-16-2018
    Location
    Cape Town, South Africa
    MS-Off Ver
    Office 365
    Posts
    9

    Re: VBA code to create separate Excel instance and hide application

    Ok but then the application will still show in the background just without a workbook? I dont want the application to be visible at all behind my userform.

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,280

    Re: VBA code to create separate Excel instance and hide application

    Whatever other workbooks are open will be visible. If you hide the application, they won't be visible and the user wouldn't have any means of opening another workbook.

    It still sounds to me like this should be an add-in, not a regular workbook.

+ 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. Opening an Spreadsheet in a Separate Instance of Excel
    By dflak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2018, 03:50 PM
  2. [SOLVED] VBA Some way to pass Data to another Application(Instance) of Excel
    By XeRo13g in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-23-2017, 11:16 AM
  3. How to activate a SEPARATE instance of excel???
    By mhouston in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 08-14-2013, 04:38 PM
  4. seperate instance of the Excel application
    By bta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2012, 08:41 PM
  5. Copy sheet to new instance of Excel Application
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2011, 03:40 PM
  6. new instance Excel application
    By extreme in forum Excel General
    Replies: 3
    Last Post: 06-25-2007, 12:41 AM
  7. [SOLVED] How do I set up Excel to open a new instance/application window w.
    By DK9144 in forum Excel General
    Replies: 1
    Last Post: 02-21-2005, 01: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