Consulting

Results 1 to 6 of 6

Thread: Solved: wb close and form close

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Solved: wb close and form close

    I have a spreadsheet then when closed it shows a form then need to close that form to close spreadsheet.

    Now I have a macro to open several spreadsheets in a folder pulls data and closes, but the problem is i need to click close on the form on each spreadsheet for it to go to the next spreadsheet.

    is there a script that I can put to auto close that form and I don't manually need to click close?

  2. #2
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    [vba] Application.CutCopyMode = False
    wb.Close False[/vba]

    The Form is call FrmTotals is there a way I can have something like this

    [vba] Application.CutCopyMode = False
    wb.Close False
    unload FrmTotals[/vba]
    Last edited by Emoncada; 06-12-2009 at 09:23 AM.

  3. #3
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Why not stop the form from showing in the first place?

  4. #4
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    That will work how can I do that.

    Note I am using a master Sheet that pulls multiple sheets with the form in it. So the Master needs to be able to tell it to either close form after opened or not open form at all.

  5. #5
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Well I don't know how you would do it because I don't know how the forms are being displayed.

    If it's when the workbook opens and uses the workbook open event then try turning off events.
    [vba]
    Application.EnableEvents = False

    ' code that opens workbooks

    Application.EnableEvents = True
    [/vba]

  6. #6
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    YEEESSSSS!!!!!!!! Norie Perfect that worked Thanks For you help.

Posting Permissions

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