Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
Hi,
I made a vba project, I want to use this only in office pc. my username is shahzadz and my computer name is medhihi0138, is there any way, to assign vba file to the specific pc, I mean it should be open only one computer, if any one try to open this file in other pc, it should not open. any suggession,pls reply me. regards. Shahzad |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
You could probably use something here to return the UserName and computer name
http://www.ozgrid.com/forum/showthread.php?t=28020 If they match, allow execution, if not, END SUB I guess you could password protect your code. Why distribute it if other's aren't to run it? -- HTH, Barb Reinhardt "Shazi" wrote: Hi, I made a vba project, I want to use this only in office pc. my username is shahzadz and my computer name is medhihi0138, is there any way, to assign vba file to the specific pc, I mean it should be open only one computer, if any one try to open this file in other pc, it should not open. any suggession,pls reply me. regards. Shahzad |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
As I posted my response, I realized one fatal flaw in your logic. What
happens when you get a new computer and the computer name is different? You won't even be able to open your own workbook. -- HTH, Barb Reinhardt "Shazi" wrote: Hi, I made a vba project, I want to use this only in office pc. my username is shahzadz and my computer name is medhihi0138, is there any way, to assign vba file to the specific pc, I mean it should be open only one computer, if any one try to open this file in other pc, it should not open. any suggession,pls reply me. regards. Shahzad |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
On Aug 2, 7:27*pm, Barb Reinhardt
wrote: As I posted my response, I realized one fatal flaw in your logic. * What happens when you get a new computer and the computer name is different? *You won't even be able to open your own workbook. -- HTH, Barb Reinhardt "Shazi" wrote: Hi, I made a vba project, I want to use this only in office pc. my username is shahzadz and my computer name is medhihi0138, is there any way, to assign vba file to the specific pc, I mean it should be open only one computer, if any one try to open this file in other pc, it should not open. any suggession,pls reply me. regards. Shahzad- Hide quoted text - - Show quoted text - Hi Mr. Barb Reinhardt, I will open my project with disabled macros. and then I will remove restriction or change according to new computer. then I will open in other pc. Anyway, I need this function to prevent my programs run other pc., some peoples are theef, they can stol my programs and they have all my passwords, because they are working on my pc. Regards. shahzad |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
If Environ("username") < "me" And Environ("computername") <
"myputer" Then Exit Sub Cliff Edwards |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
On Aug 2, 8:27*pm, ward376 wrote:
If Environ("username") < "me" And Environ("computername") < "myputer" Then Exit Sub Cliff Edwards Hi, Cliff Edwards, I would appreciate, if you could explain how to use your code, I mean which place and what is the full procedure will be..... can I use this in Auto_Open macro or where .... Regards. Shahzad |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
The only way people can get to my files is to log on to my computer with my
user name and password. I'd suggest you improve the security on your computer. FYI, I'm not and never will be a Mr. ;) "Shazi" wrote: On Aug 2, 7:27 pm, Barb Reinhardt wrote: As I posted my response, I realized one fatal flaw in your logic. What happens when you get a new computer and the computer name is different? You won't even be able to open your own workbook. -- HTH, Barb Reinhardt "Shazi" wrote: Hi, I made a vba project, I want to use this only in office pc. my username is shahzadz and my computer name is medhihi0138, is there any way, to assign vba file to the specific pc, I mean it should be open only one computer, if any one try to open this file in other pc, it should not open. any suggession,pls reply me. regards. Shahzad- Hide quoted text - - Show quoted text - Hi Mr. Barb Reinhardt, I will open my project with disabled macros. and then I will remove restriction or change according to new computer. then I will open in other pc. Anyway, I need this function to prevent my programs run other pc., some peoples are theef, they can stol my programs and they have all my passwords, because they are working on my pc. Regards. shahzad |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
Sorry Shazi, I should have been more thorough - put the code in the
workbook module (ThisWorkbook) and use the open event to trip it. I also changed to a block style if so you can put your code in. Private Sub Workbook_Open() If Environ("username") < "shahzadz" And _ Environ("computername") < "medhihi0138" _ Then Exit Sub Else 'do your stuff End If End Sub You'll want to verify your environ("username") also - sub check() msgbox environ("username") end sub You may want to use application.username instead sub check() msgbox application.username end sub Just preference on your part on whether to use your environ or application username. Cliff Edwards |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
Just thinking - you should use the logic that if your username and
computername are correct, run your code, rather than if both your username and computername aren't correct, then don't run your code. Private Sub Workbook_Open() If Environ("username") = "shahzadz" And _ Environ("computername") = "medhihi0138" _ Then 'do your stuff Else Exit Sub End If End Sub Cliff Edwards |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
You created a VBA project in a workbook on your computer and you don't want
someone to steal your code from this workbook.........right? Don't distribute the workbook. Or use encryption to secure the workbook from being opened by anyone else. If you want others to be able to use the workbook, there is no way you can prevent them from stealing your code. You can lock the project for viewing but a good hex editor or password cracker can bypass that. Gord Dibben MS Excel MVP On Sat, 2 Aug 2008 09:10:08 -0700 (PDT), Shazi wrote: Hi, I made a vba project, I want to use this only in office pc. my username is shahzadz and my computer name is medhihi0138, is there any way, to assign vba file to the specific pc, I mean it should be open only one computer, if any one try to open this file in other pc, it should not open. any suggession,pls reply me. regards. Shahzad |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
Gord is right - anything in an xl file can be had by someone if they
really want it. I also didn't read your question thoroughly, or was thinking of another question when I put together my posts... You only want it to open on one computer? Regardless of user? You can't keep it from opening, but you could tell it to close if the computer name doesn't fit your criteria. If macros aren't enabled, this won't help. If your goal is to secure your code you should protect the project with a password. If your goal is to hide/protect the data in the workbook, you should hide the sheets you don't want to be accessible (use veryhidden from the properties of each sheet in the project explorer) but leave at least one blank one (or one of your choice) visible. Excel requires that at least one sheet be visible. Then you can use VBA to unhide the sheets you want unhidden - either in the open event or manually. That way, if the workbook is opened without enabling macros, the hidden sheets stay hidden. Any or all of these measures will only keep casual users out of your data/code. Private Sub Workbook_Open() If Environ("computername") < "yourputer" Then Me.Close Else Dim ws As Worksheet For Each ws In Worksheets ws.Visible = xlSheetVisible Next ws End If End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim ws As Worksheet For Each ws In Worksheets If ws.Name < "yoursheet" Then ws.Visible = xlSheetVeryHidden End If Next ws End Sub Cliff Edwards |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Project to the Specific Computer
See here how to use the a vba in excelent instructions.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=234 "Shazi" wrote: Hi, I made a vba project, I want to use this only in office pc. my username is shahzadz and my computer name is medhihi0138, is there any way, to assign vba file to the specific pc, I mean it should be open only one computer, if any one try to open this file in other pc, it should not open. any suggession,pls reply me. regards. Shahzad |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Allow VBA Program to use in Specific Computer | Excel Programming | |||
How to protect some specific module in VBA project? | Excel Programming | |||
export a workbook to specific loc on other computer via internet | Excel Programming | |||
Select specific Project in VBA | Excel Programming | |||
HELP - How can I protected a excel file to specific computer | Excel Programming |