+ Reply to Thread
Results 1 to 8 of 8

Delete VBA code in all files

  1. #1
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Delete VBA code in all files

    Hi,

    I need your help to solve the following problem. In a folder I have several files and each file type .xlsm is password protected VBA code. How could I do to delete VBA code in each file. The password is the same for all VBA code is "secret" without the quotes. The files are not protected.
    Thank You.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete VBA code

    You don't need the password, you could just open each file and save it again as xlsx format. This format does not include VBA elements so they would be excluded, and you'd still have your originals.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Delete VBA code

    How can I do that? Can you help me with VBA code? I do not mean manually, because there are too many files .

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete VBA code in all files

    Maybe something like this... edit the fPATH first.
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 02-16-2015 at 11:42 AM.

  5. #5
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Delete VBA code in all files

    JBeaucaire,

    I changed the path to the folder with files.
    The code creates a folder XLSX, but here not even a file copy.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Delete VBA code in all files

    Hi, Indi_Ra,

    please have a look in the directory for all files as Jerry spoecified a folder for saving but for some reason missed to add that in the code line
    Please Login or Register  to view this content.
    which should save in the same directory/folder as the original files.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  7. #7
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Delete VBA code in all files

    HaHoBe,

    I did not understand. VBA Code has not created any .xlsx files in the original folder or folder XLSX.

    I modified this line in code and now it works.

    Please Login or Register  to view this content.
    Thanks
    Last edited by Indi_Ra; 02-16-2015 at 04:26 AM.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Delete VBA code in all files

    OOps... my bad! I'll edit the original code above so the solution is posted and accurate. My apologies.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Write text files, run another program, delete txt files upon alt-tab / exit..
    By niels007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2011, 10:05 AM
  2. Delete all files in directory, msgbox list files before delete.
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2010, 09:28 PM
  3. Application.GetOpenFilename, Attach files to Email, Move files, Delete Original.
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2009, 12:11 AM
  4. Limit macro conversion to only .txt files or delete existing .xls files
    By macro_noob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2008, 03:54 PM
  5. vb code to return files giving too many files error message
    By camcrazy08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2007, 04:53 PM

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