+ Reply to Thread
Results 1 to 5 of 5

How To Convert VBA Code To DLL/XLL?

  1. #1
    Registered User
    Join Date
    02-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question How To Convert VBA Code To DLL/XLL?

    Hi all,

    I am new to the forum. Excel's security isn't very robust. Even if I password protect the VBA code I've written, it could be easily cracked. Therefore, I would like to improve security of the code by "porting" the Excel VBA code I've written into a DLL or XLL file.

    Right now my spreadsheet is entirely automated by VBA. I'd like to rewrite the VBA code so that it basically only calls up the DLL/XLL. The DLL/XLL, which would contain the majority of the code, would then execute the applicable subroutines/functions requested by the user. This would hopefully improve the security and make it easier for me to maintain since all I would need to do is update/modify the DLL/XLL file, not the spreadsheet.

    THE PROBLEM:
    I have never created a DLL/XLL before and I'm not experienced in VB, C++, etc (only Excel VBA), so I need a little guidance on the following:
    1. Is the approach I've described the best approach to maximize code security? If not, what would you recommend?

    Assuming the DLL/XLL approach is best,...
    2. What is the Excel VBA command(s) needed to call up the DLL/XLL?
    3. What commands are needed within the DLL/XLL file to communicate with/control the Excel spreadsheet?
    4. Can I copy and paste the Excel VBA code I've written "as is" into the DLL/XLL or do I need to convert it to VB in order for it to work?
    5. Do I need to manually add the DLL/XLL as a Reference or can it all be done programmatically without needing an explicit reference (preferred)?

    My VBA skills are only at an intermediate level, so it would be helpful if you would provide examples or err on the side of being detailed in your response so I don't have to ask too many follow-up questions. :-)

    Thank you in advance for your help!

    CK

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How To Convert VBA Code To DLL/XLL?

    Hello CK,

    Welcome to the Forum!

    Have a look at this link for the Excel Compiler http://www.doneex.com/index.php?opti...FQlPgwodbSTAeA
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How To Convert VBA Code To DLL/XLL?

    Thanks for the welcome and link, Leith. I appreciate it!

    The compiler is an interesting approach, but I'd prefer to learn how to do this the "old fashioned" way. My spreadsheet/app is not very sophisticated and there's not a lot of VBA code, so I don't want to spend money for a program that may be more than what I need, especially since it's not a commercial app I plan on selling. I just want to improve the security of my code by putting it into a DLL/XLL.

    I'm hoping someone can help me out.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: How To Convert VBA Code To DLL/XLL?

    Who exactly are you making it secure from if you are not selling or creating a commerical app?

    For most users VBA password is adequate protection for inhouse code.

    You could look at xldna.
    http://www.blog.methodsinexcel.co.uk/category/xl-dna/
    http://exceldna.codeplex.com/
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    02-15-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How To Convert VBA Code To DLL/XLL?

    The reason why I want to use a method that goes beyond VBA's native protection is not to make an extra buck by selling the "app", but rather find a way to make maintaining the "app" easier. I want to design it in such a way that it doesn't become a maintenance nightmare for me. Specifically, I don't want lots of different versions floating around over time that people ask me to maintain or they decide to tinker with. Instead, I'd prefer to create one DLL/XLL file that harbors the code that I can update/modify as necessary. And, if possible, I'd like to place this DLL/XLL in a centralized location (e.g., server). With VBA, the code goes with the spreadsheet and it could easily get out of control as people forward the spreadsheet onto others. Hope that makes sense.

    Any ways, thanks for the tip on xldna. I'll look into it!
    Last edited by CaliKidd; 02-17-2011 at 11:49 AM. Reason: Cut out a lot of misc info that was off topic.

+ 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