+ Reply to Thread
Results 1 to 5 of 5

Save file in macro

  1. #1
    Registered User
    Join Date
    10-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    54

    Save file in macro

    Hi
    i want to save a file which has a macro written in it and i want to save as the file in a directory (the same place where the file is there) as in xlsx format. and no change should be done in the macro file. and after saving the excel should give a message that the file is successfully saved in "the folder where it is being saved"

    please help.

  2. #2
    Registered User
    Join Date
    10-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Save file in macro

    i also want that the saved file (saveas in xlsx) as a readonly.

  3. #3
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Save file in macro

    This is pretty generic, but i pulled this from a workbook with a similar macro.

    To answer your question more specifically you would need to provide and example.
    Please Login or Register  to view this content.
    Basically, you will need to use SomeworkbookVariable.save or someworkbookVariableName.saveas to accomplish this. I also had an error section to handle the situation where the expected save location didn't exist on the computer.

    To add a message, use a message box.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  4. #4
    Registered User
    Join Date
    10-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Save file in macro

    i dont want to save macro....macro file is a template kind for me. i want the extracted data to be saved, the workbook contains diff sheet. and i suppose this code will not make the save as file( the file which is being saved in xlsx) in read-only.

  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Save file in macro

    yes....you need to work out the tweeking yourself unfortunately (or provide an example).

    If you type, thisworkbook.saveas, into a code module ... place your cursor in the .saveas portion of the text ... then press F1, you will get the help for the .saveas method!

    THere are many parameters. ReadOnlyRecommended is one of them, and it may suite your needs. You can also just protect the workbook or specific worksheets with a password to prevent changes.

    You may not like the choosen file format, but my previous post shows where you put the desired XLfileformat (again, you can get a list of them from the help menu. you may like the xlWorkbookDefault, xlOpenXMLWorkbook, xlWorkbookDefault... etc.
    Last edited by GeneralDisarray; 11-29-2012 at 12:26 PM. Reason: typo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1