Results 1 to 2 of 2

Thread: [RESOLVED] How to close and save an excel file using VBA

  1. #1

    Thread Starter
    Addicted Member allankevin's Avatar
    Join Date
    Jul 2008
    Posts
    173

    Resolved [RESOLVED] How to close and save an excel file using VBA

    Hi Guys,

    can anyone help in saving and closing the excel File using a VBA code? and also is it posible to disable the minimize restore and close buttons of the excel workbook?

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: How to close and save an excel file using VBA

    Code:
    activeworkbook.save
    activeworkbook.close
    though generally it is safer to specify the workbook by name, also if you want to close excel
    Code:
    workbooks("myworkbook.xls").close
    application.quit
    robdog may have some code to disable the red X, search in his posts at top of forum
    Last edited by westconn1; Aug 1st, 2008 at 05:55 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width