Your help is need to fix program input

  • i am trying to delete Module1 and Thisworkbook macro in saveas file.but macro is not deleting the saveas file


    Edited once, last by royUK: Add Code Tags ().

  • Welcome to the Forum.


    Please read the Forum Rules.


    1. You should use Code tags when posting code on the Forum

    2. You should not PM members with your question.

  • i have master macro template (.xlsm) help to transferring data from "A file to master template. Input "A" maybe allow two different format ( .Xlsx Or .xls) , then saveas file output file (B) should be files as (.xls) . Master template i protected pwd code in VB properties. Like to remove all code in Output file (B). How can i unprotected VB project using code to delete Module codes ? . Getting Error if master file is protected not allowing me to run removing codes. If i unprotected master template by manually , it allows to delete code in output file.


    Edited once, last by royUK: Add code tags again ().

  • HI ranjith_12 welcome to OzGrid

    You need to put a bit of effort in on these forums, Roy has added a code tags and noted that this request has been made. There is a link to the forum rules in our signs at the bottom of our posts "Forum Rules", can I ask you read through this link and add code tags to the above post before progressing. People will me more willing to help as the code looks great and is a lot easier to read in order to assist you

    Many thanks for understanding


    jiuk

  • Output file using it for different application, that application will allow only Xls format. is it possible to save it in Xlsx and then overwrite it to Xls within master code template?

  • maybe like this


    Code
    1. ''/// change newname to the new name you want to us
    2. ThisWorkbook.SaveAs Filename:=NewName, FileFormat:=51
    3. ''/// save as xls
    4. ActiveWorkbook.SaveAs ActiveWorkbook.Name, FileFormat:=56

    You could add code to delete the xlsx file

  • Getting Compile error: Named argument already specified and multiple warning error


    Code
    1. targetfile = Range(cell_target_File).Value + "Upload"
    2. ThisWorkbook.SaveAs Filename:=targetfile, FileFormat:=xlOpenXMLWorkbook
    3. ActiveWorkbook.SaveAs ActiveWorkbook.Name, (".xls"), FileFormat:=56
  • This works for me


  • This will delete the xlsx file if you don't need it


  • My badness output file extension is not recognized, So getting Error and also output file have module code


  • That message indicates The VBA project is protected.


    When you getting it because the code that I posted wouldn't cause it?


    Also, what has the clipboard got to do with it?

  • if i run your code . Getting error argument already specified (Highlighted 51 red)

    Code
    1. FileFormat:=51


    Edited once, last by ranjith_12 ().

  • if i directly mention conversion number . Getting " Kill sPath as error".