Consulting

Results 1 to 12 of 12

Thread: Open a book in the background

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    Open a book in the background

    I am currently using the code to open a workbook and get information from it. However, I want it to not be shown to the user. Can I open the book - automatically Hidden?

    [VBA]Set wbRef = Workbooks.Open(sWorkbookToOpen)
    wbRef.Visible = False[/VBA]

    Thank you,
    Daniel

    http://studenthacker.blogspot.com/

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Hide the window, not the book.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    Thank you XLD,

    That is what I was doing first. Unfortunately it shows the book in the taskbar first then hides. I don't want it to show at all. Is that possible?
    Thank You,
    Daniel Blois
    http://studenthacker.blogspot.com/

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Not that I am aware of. Maybe set Ignore Other APplications temporarily.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    Xld,

    you are not talking about Application.screenupdating are you? if that isn't what you are talking about please tell me how to do that?

    Daniel
    Thank You,
    Daniel Blois
    http://studenthacker.blogspot.com/

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    No I actually meant Windows in Taskbar, Tools>Options>View>Windows In Taskbar. Record a macro to get the code
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    I will record the marcro but how do I find that on 2007 if you know? I just checked the View Tab Ribbon and I don't see it.
    Thank You,
    Daniel Blois
    http://studenthacker.blogspot.com/

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Click the Orange Office button

    Click the Excel Options button

    Select Popular from the left-hand menu pane

    In the right-hand pane, click the 'Sow developer tab in the Ribbon' checkbox

    record macro is then found in the Code Group of the Developer ribbon.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    No, sorry I know how to record a macro in Excel 2007. I don't know how to get to Tools>Options>View>Windows in Excel 2007.
    Thank You,
    Daniel Blois
    http://studenthacker.blogspot.com/

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Click the Orange Office button

    Click the Excel Options button

    Select Advancedf rom the left-hand menu pane

    In the Display section of thr right-hand pane, click the 'Show all windows in the taskbar' checkbox

    record macro is then found in the Code Group of the Developer ribbon
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  11. #11
    VBAX Mentor tstav's Avatar
    Joined
    Feb 2008
    Location
    Athens
    Posts
    350
    Location
    Hi Djblois,
    1.Create a new instance of Excel
    2.DO NOT MAKE IT VISIBLE
    3.Open the workbook using this instance

    [VBA]Sub HideOpenWorkbook()
    Dim xlApp As Object
    Set xlApp = CreateObject("Excel.Application")
    'xlApp.Visible = True
    xlApp.Workbooks.Open "C:\1.xls"
    End Sub
    [/VBA]

    From then on, for anything you will want to do with this Workbook, you're going to have to be using the xlApp just like it is used in the code to open the sample Workbook.
    He didn't know it was impossible, so he did it. (Jean Cocteau)

  12. #12
    VBAX Mentor tstav's Avatar
    Joined
    Feb 2008
    Location
    Athens
    Posts
    350
    Location
    Also, remember after closing the Workbook, to remove the xlApp object because it's taking up memory
    [VBA]
    Sub HideOpenWorkbook()
    Dim xlApp As Object
    Set xlApp = CreateObject("Excel.Application")
    xlApp.Workbooks.Open "C:\1.xls"
    xlApp.Workbooks("C:\1.xls").Close False
    Set xlApp = Nothing
    End Sub
    [/VBA]
    He didn't know it was impossible, so he did it. (Jean Cocteau)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •