Results 1 to 7 of 7

Thread: [RESOLVED] closing excel file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    27

    Resolved [RESOLVED] closing excel file

    hi all, i am opening an excel file for some updation, but after my completion of updation. i am prompting for Save changes in that file while i am closing that excel application.

    eg:
    xl.Workbooks.Open(fp) 'fp-filename

    --------
    --------
    doing updation here
    ---------
    ---------

    xl.ActiveWorkbook.Save
    xl.ActiveWorkbook.Close ' while exceuting this line only i am
    promting for "Save Changes in the
    file"

    i have to close this excel file without any prompting same time i have to save the updations done in that file...plz help me to resolve this problem
    thanks in advance

  2. #2
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872

    Re: closing excel file

    Use: xl.ActiveWorkbook.SaveAs "Filename"



    (Note that this is free-hand coding, it could contain errors, but it should help you on the way)
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    27

    Re: closing excel file

    thanks for ur reply yar. i can use the SaveAs option..
    if i use xl.ActiveDocument.SaveAs "FileName", then it is promting for File Replace.... it is saying that the "folder contain another file with the same file, click Yes to replace it", so i have to Confirm File Replacement with the xl.ActiveDocument.SaveAs option itself...
    Is there any option for file replacement while using SaveAs option.

  4. #4
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872

    Re: closing excel file

    - If you want to save the existing file as itself , just use save.
    - If your excel file is not saved yet, or you want it to save as another filename. Check if the filename wich you want to save allready exists, if so delete the file and then use SaveAs.
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    27

    Re: closing excel file

    i want to save the existing file only... for this i am using:

    xl.ActiveWorkBook.Save
    xl.ActiveWorkBook.Close fp 'fp-filename

    but, i am prompting an window "Do you want to save the changes you made to file ?"
    i should not display this window, instead it has to automatically save the changes

  6. #6
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872

    Re: closing excel file

    vb Code:
    1. xl.ActiveWorkBook.Close True, "FileName.xls"

    From the excel help:
    expression.Close(SaveChanges, FileName, RouteWorkbook)
    SaveChanges = True, changes are saved to the filename specified
    SaveChanges = False, changes are not saved
    SaveChanges = Not filled in, The user is prompted with the question.
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    27

    Re: closing excel file

    thank u

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