+ Reply to Thread
Results 1 to 2 of 2

Add VBA code to an Excel by using VBA code

  1. #1
    Forum Contributor
    Join Date
    01-16-2009
    Location
    Ill.
    MS-Off Ver
    Excel 2010
    Posts
    190

    Add VBA code to an Excel by using VBA code

    Hi all - - I have the code below which assigns a password to a group of Excel file in a specific folder. It will open the first Excel workbook then saveas with a unquie password (Thanks to TMshuckk for his help on putting this together - - awesome!). This password code repeats it's self going through each excel workbook. Here is my next thought...I want to add to the password code, another set of VBA code that will 'lock' a group of columns, while leaving other columns available for editing and updates.

    Is it possible to incorporate the Locking VBA code while the Workbook is open via the Password VBA code?

    This is the locking VBA Code, I wish to incorporate into the Password VBA Code:
    Please Login or Register  to view this content.
    Here is the Password Code:
    Please Login or Register  to view this content.
    Is this even possible? Thanks again! Hope everyone has a good weekend!

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

    Re: Add VBA code to an Excel by using VBA code

    Hi, Ironman,

    you have to change the fileformat of the workbooks saved from xlOpenXMLWorkbook (without macro's in 2007-2010, xlsx) to xlOpenXMLWorkbookMacroEnabled (with or without macro's in 2007-2010, xlsm). And for passing code you may have a look at Chip Pearsonīs Programming The VBA Editor especially Copy A Module From One Project To Another and Creating An Event Procedure.

    HTH
    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

+ 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