Consulting

Results 1 to 2 of 2

Thread: How to close the all excel workbooks once i open a one excel workbook

  1. #1
    VBAX Regular
    Joined
    Feb 2016
    Location
    Bangalore,India
    Posts
    11
    Location

    Lightbulb How to close the all excel workbooks once i open a one excel workbook

    Hello Everyone

    I have prepared one tool in my office , that tool is very much useful and i got good appreciation as well , now i have one issue with that, i have stuck with that problem, i.e.,if i open that excel , i can work with other excel workbooks , so am planning write workbook open event procedure code in such a way that , once i open a tool other excel workbooks has save and close , if excel workbooks which has not saved has save in default path of desktop ..can u guys help with this

  2. #2
    VBAX Regular
    Joined
    Feb 2016
    Location
    Bangalore,India
    Posts
    11
    Location
    This is a code i thought , can u guys help me to enhance it , how to save and close a workbooks in default path.

    Sub closewbook()


    Rem to close all workbooks except this w.book(tool)


    Dim singlewbook As Workbook


    For Each singlewbook In Workbooks


    If singlewbook.Name <> ThisWorkbook.Name Then
    singlewbook.Close True
    End If


    Next singlewbook


    End Sub

Posting Permissions

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