+ Reply to Thread
Results 1 to 4 of 4

Open 2 workbooks and hide both of them

  1. #1
    Registered User
    Join Date
    02-10-2005
    Posts
    10

    Open 2 workbooks and hide both of them

    I'm sure this has been beat to death, but I've spent the past 2 days looking for a thread or something guiding me in the right direction.

    What I'm trying to do is run a macro when 'main.xls' is opened.

    The macro is to then open 2 more workbooks and then hide both of those newly opened workbooks.

    The workbooks to open are: customerleads.xls and followup.xls.

    All three files(main.xls , customerleads.xls , followup.xls) are found in folder c:\excel

    To Review:
    1.) The macro is to run when main.xls is opened
    2.) The macro then opens 2 workbooks named: customerleads.xls and followup.xls
    3.) The macro is to then hide customerleads.xls and followup.xls

    I'm so frustrated with this I'm about to pull my hair out!

    Thanks for you help folks,
    Nick
    U of Toledo
    Marketing and E-Commerce

  2. #2
    Registered User
    Join Date
    02-10-2005
    Posts
    10
    So far this is what I've got.

    Sub OpenWorkbook()
    Dim wbkmain As Workbook

    vPath = ActiveWorkbook.Path
    vWBOpenDataFileName = "customerleads.xls"
    Set wbkmain = Workbooks.Open(vPath & "\" & vWBOpenDataFileName)
    ActiveWindow.Visible = False
    vWBOpenDataFileName = "followup.xls"
    Set wbkmain = Workbooks.Open(vPath & "\" & vWBOpenDataFileName)
    ActiveWindow.Visible = False
    vWBOpenDataFileName = "main.xls"
    Set wbkmain = Workbooks.Open(vPath & "\" & vWBOpenDataFileName)
    ActiveWindow.Visible = True

    End Sub

    Now my issue here is I'm unable to get the macro to load automatically when I open main.xls

    Also when I close main.xls workbook it asks me to save both customerleads.xls and followup.xls

    I would like to not have to save both customerleads.xls and followup.xls because if I do save; the next time I go to open customerleads.xls or followup.xls it is hidden and I would have to go and unhide. This could pose a problem for those who would use this document that aren't familiar with excel.


    Or I could just save and when I open either customerleads.xls or followup.xls I can have a macro that allows for it to automatically unhide, but would that conflict with the current macro I have in main.xls?

    Any suggestions - I'm lost!

  3. #3
    Registered User
    Join Date
    02-10-2005
    Posts
    10
    I've made some progress!

    So far I am able to load the macro as soon as I open the workbook. The code I've been using is:

    Sub Auto_Open()
    Dim wbkmain As Workbook

    vPath = ActiveWorkbook.Path
    vWBOpenDataFileName = "customerleads.xls"
    Set wbkmain = Workbooks.Open(vPath & "\" & vWBOpenDataFileName)
    ActiveWindow.Visible = False
    vWBOpenDataFileName = "followup.xls"
    Set wbkmain = Workbooks.Open(vPath & "\" & vWBOpenDataFileName)
    ActiveWindow.Visible = False
    vWBOpenDataFileName = "main.xls"
    ActiveWindow.Visible = True

    End Sub


    This sounds kind of tricky, but several excel newbies will be using this workbook and they will be confused if the customerleads.xls and followup.xls workbooks open as hidden when they go to access those workbooks. (they will open as hidden if I save out when accessing main.xls).

    Any suggestions - This is my only major hangup and I'm in dire help =(

  4. #4
    Registered User
    Join Date
    02-10-2005
    Posts
    12
    Nick-- Not sure what you mean by "hide"...

    Anyway, this simple code will open the other two workbooks and then activate main.xls.

    strPath = "C:\excel\"

    Workbooks.Open FileName:=strPath & "customerleads.xls"
    Workbooks.Open FileName:=strPath & "followup.xls"
    Windows(1).Activate

    Does that help?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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