IT_roofer

I appologize if this is not the place to ask this, however, I could not find an Excel Programming specific MSDN forum.

**PLEASE DO NOT REFER ME TO THE OFFICE DISCUSSION GROUPS**

=> I have been there and done that and I'm looking here now for help <=

There seems to be some debate on whether or not a person can lock/unlock a VBAProject in Excel. I've been told you can't. I've been told it can be done using SendKeys which is supposedly problematic... I am not one to believe that something, especially with computers, simply can't be done. Sooo...

I have an extensive Excel Userform-based estimating program I've been writing for the last 7 months. I am now to a point where I'm about to release it and I want to keep the guts protected. However, when the final form is copied into the new workbook, my deletevbacode macro won't run because the protection of the VBCode carries over.

So here's my question(s):

  1. Is there a way to programmatically lock/unlock the VBAProject
  2. If not, then how can I keep the project protection from carrying over into the new workbook
  3. If neither of the above are a possibility - I'm open for suggestions...

Thanks in advance!



Re: Visual Studio Tools for Office Unlocking a project...

Dennis Wallentin

Hi,

**PLEASE DO NOT REFER ME TO THE OFFICE DISCUSSION GROUPS**

=> I have been there and done that and I'm looking here now for help <=

#1 The question is off topic in this forum

#2 Read this information

My opinion on the subject is that it's beyond the code of ethics to publish any kind of solution to "overcome" the security in Excel.

Unfortunately too many developers spend time to lock their solutions ( i e in order to protect the intellectual propery. When it's time to update and to ship the updated solution it seems that's a question of workaround Excel's security. All in all, it's a wrong path.






Re: Visual Studio Tools for Office Unlocking a project...

IT_roofer

#1 - I already stated I thought I was in the wrong place so reitterating that same information does nobody any good.

#2 - I already read the link you posted. I am not a new to forums. I do my research before I post and as I said, I couldn't find this information anywhere else. So what better place to ask than a place that develops tools for Office Since I am developing a 'tool' for my company to use in Excel, I thought this might be the place to ask that question because this is 'Tools for Office'... right Again I say my apologies for being in the wrong area. If there is an MSDN forum for this, kindly point me in the right direction and I'll go that way (with the exception of the microsoft.public.excel.programming websites).

About your opinion: Regardles of the fact that I agree with you on the 'code of ethics', I didn't ask for your opinion; I asked for information regarding an issue with my project. At certain points it is entirely necessary to 'work around' built-in security to make things work correctly and there is absolutely nothing wrong with that when you're the developer provided you stay within the confines of the program you're working in. I stated that if it couldn't be done I was open to suggestions on how to protect my code!

It's not a wrong path when I am the developer. If you would have read my entire post you would know that I am not trying to circumvent the security of Excel, I am trying to enable my code to delete itself upon replication to a new worksheet out of the main program to protect 2 things: 1) the end user from errors in code execution because the sheet controls were deleted and 2) protection of my code from tamper. I even stated that I wanted to "...keep the guts protected..." I am a certified CCNA & MCSA and I know the reprocussions of reverse engineering so for you to go and state that I am trying to break someone elses protection code is down right preposterous and rude. Thanks for being informative, Dennis.





Re: Visual Studio Tools for Office Unlocking a project...

Dennis Wallentin






Re: Visual Studio Tools for Office Unlocking a project...

IT_roofer

with the exception of the microsoft.public.excel.programming websites).

[/quoute]

What's wrong with that forum

...use in Excel, I thought this might be the place to ask that question because this is 'Tools for Office'... right

Wrong

About your opinion: Regardles of the fact that I agree with you on the 'code of ethics', I didn't ask for your opinion

It's free

I am a certified CCNA & MCSA and I know the reprocussions of reverse engineering so for you to go and state that I am trying to break someone elses protection code is down right preposterous and rude.

OK so You can perhaps handle it but what about other who take part of the solution. Or do You believe we have a private conversation in a public thread.

Thanks for being informative, Dennis

You're welcome and enjoy Your day

What's wrong with that forum

Been there. Researched that. Found no solution.

Wrong

Oh, I'm sorry. I thought 'Tools for Office' meant Tools for Office.

It's free

It's not wanted. A solution is what's wanted. Since you seem to know all about this place, point me to the right place, Dennis. But don't point to the other Office forums...

OK so You can perhaps handle it but what about other who take part of the solution.

I can't be responsible for anyone else's actions but my own. I would like to think people would be responsible with good information, but that would be nieve. Besides, there are plenty of Excel cracks out there and if I was really after a crack, why would I come here I would go some place else for that rather than try to program my own. Crackers (not hackers) are lazy and wouldn't go through that much effort.

Or do You believe we have a private conversation in a public thread.

Do you realy think I'm that unintelligent I'm gritting my teeth because the last thing I want to do is start an arguement on a Microsoft website! That would be dumb. If you have an answer you would like to keep out of the public domain, I would be more than willing to keep the conversation private to avoid misplacement of potentially dangerous information. I just don't understand why you have to be so difficult. I said in the beginning to point me in the right direction (other than where I had already been) if this was indeed the wrong place to be. If you have any other resources, please post them.

Thanks.





Re: Visual Studio Tools for Office Unlocking a project...

Cindy Meister

IT_roofer wrote:

Wrong

Oh, I'm sorry. I thought 'Tools for Office' meant Tools for Office.

Visual Studio Tools for Office. Not generally "tools for office", but a specific set of tools that supports using the .NET Framework for Office documents, rather than VBA embedded in the files. And since your request is very specifically for VBA, that puts you very much off-topic here :-) So I'd say your research wasn't that extensive... (I'm being a bit mean, I know, but this exchange has irritated me a bit )

IT_roofer wrote:

It's free

It's not wanted. A solution is what's wanted. Since you seem to know all about this place, point me to the right place, Dennis. But don't point to the other Office forums...

There aren't any other Office forums. The forum interface is targeted primarily at newer technology, such as Visual Studio. Office and VBA are in the newsgroup interface. That's where you'll find the experts for the technology you're using. If the folks in excel.programming say it can't be done, considering the sheer intellectual weight and problem-solving capaabilities of people like Stephen Bullen, John Walkenbach, Rob Bovey, et al, it probably cannot be done. As to "should not": The fact that you're the "owner" doesn't change the fact that someone who is not an owner could take advantage of the same hoped-for loophole you'd like to take advantage of in order to do "bad things". That's certainly a very good reason for MSFT to not have left such a loophole.

However, if you'd be willing to consider a different approach than embedded VBA code, you could have actually ended up in the right place without realizing it :-) A VSTO solution, document-level Excel customization would solve exactly this "technical difficulty": maintaining the code separately from the files. VSTO code is kept in a separate DLL, linked to the Excel workbook / template through "magic" (well, it's not, really, but it sure seems like it). If you move information to a separate workbook, that link is lost. Or you also have the option to remove the link from a workbook so that it can be sent to others who don't have access to your code.






Re: Visual Studio Tools for Office Unlocking a project...

IT_roofer

(I'm being a bit mean, I know, but this exchange has irritated me a bit )

You're not being mean at all and believe me, this exchange has irritated me a bit also. Thank you for explaining exactly what VSTO does as, even though I read through the "READ FIRST" and "READ NEXT" bulletins, I was not fully understanding what VSTO was for. In typical fashion for me, I skimmed over the bulletins, saw "Tools for Office" and thought I might have found a place where I could get some clear-cut answers. Alas, no. I found a person who, in previous posts kindly pointed a person to the correct place for information, came after me like a phirranna. I don't like engaging in conversations like that, however, I've been put into a position that has caused me to learn how to do this on the fly (not anyone's fault, I know), I'm on a dealine and my patience level is wearing thin. Sorry.

...If the folks in excel.programming say it can't be done, considering the sheer intellectual weight and problem-solving capaabilities of people like Stephen Bullen, John Walkenbach, Rob Bovey, et al, it probably cannot be done...

I didn't speak to any of those gentlemen, however, the man that did answer my post over there said that there was a way to do it, but that way was problematic at best. As a novice code writer, I have enough problems with the buggy code I write so I don't need to be going and adding something else that's problematic by nature. And having gone through the classes to become certified, I certainly understand the reasoning behind leaving loop holes closed.

However, if you'd be willing to consider a different approach than embedded VBA code, you could have actually ended up in the right place without realizing it :-) A VSTO solution, document-level Excel customization would solve exactly this "technical difficulty": maintaining the code separately from the files. VSTO code is kept in a separate DLL, linked to the Excel workbook / template through "magic" (well, it's not, really, but it sure seems like it). If you move information to a separate workbook, that link is lost. Or you also have the option to remove the link from a workbook so that it can be sent to others who don't have access to your code.

I'm always open for something new. Matter of fact, that's how I got into this predicament to being with. The simple fact is I don't have the time to learn something new to solve my problem. I am actually going to port my Excel/VBA over to being a stand-alone program through VB (or another method) at a later time. So maybe when that project begins I can return here for some practical information to make my programming life easier. Until then, I will not disrupt this forum again.

In the midst of this fued, I managed to find a small work-around to my problem. It doesn't disable security. It doesn't delete my code like I want, but it does check to see if certain parameters match and, if not, disables code from running. Simple and done.

I apologize to anyone I offended.





Re: Visual Studio Tools for Office Unlocking a project...

Cindy Meister

Glad to learn you've found an approach you can use for the present :-)

IT_roofer wrote:

I found a person who, in previous posts kindly pointed a person to the correct place for information, came after me like a phirranna.

I suspect Dennis may be under a bit of deadline pressure currently, as well, considering his posting rate the last week or so :-) Happens to all of us at one time or another. And, from the sound of it, this particular request may have "pushed a button". Everyone has one or more sensitive issues; at least, I know I do.

IT_roofer wrote:
I didn't speak to any of those gentlemen, however, the man that did answer my post over there said that there was a way to do it, but that way was problematic at best. As a novice code writer, I have enough problems with the buggy code I write so I don't need to be going and adding something else that's problematic by nature. And having gone through the classes to become certified, I certainly understand the reasoning behind leaving loop holes closed.

Yep, SendKeys is certainly something you want to avoid, except for a little "applet" you'd be using yourself and would understand when it failed intermittently! I'd have probably used stronger words than "problematic at best" <G>

IT_roofer wrote:
I'm always open for something new. Matter of fact, that's how I got into this predicament to being with. The simple fact is I don't have the time to learn something new to solve my problem. I am actually going to port my Excel/VBA over to being a stand-alone program through VB (or another method) at a later time.

Mmm. Learning the .NET Framework is quite a big bite, but personally I find it fascinating to compare the two worlds (VBAngel vs. .NET, whether VB.NET or C#). As with most things, each has its strengths and weaknesses. If you decide to take a look at VSTO, the starting point on the msdn website is here.






Re: Visual Studio Tools for Office Unlocking a project...

IT_roofer

Cindy Meister wrote:
I suspect Dennis may be under a bit of deadline pressure currently, as well, considering his posting rate the last week or so :-) Happens to all of us at one time or another. And, from the sound of it, this particular request may have "pushed a button". Everyone has one or more sensitive issues; at least, I know I do.

I know exactly how he feels. I'm in the pressure cooker as we speak. Which is probably why I snapped back instead of ignoring him like I usually would. Oops.

Cindy Meister wrote:
Learning the .NET Framework is quite a big bite...

I'm still learning, but I became proficient enough with VBA in 6 months so why not "chew" on something bigger I'm always up for a challenge!

I will take a look at VSTO when I'm out of this cooker. Thanks for the help, Cindy.