PC Review


Reply
Thread Tools Rate Thread

Code or Even ?

 
 
Tufail
Guest
Posts: n/a
 
      23rd Dec 2008
hello all,
is there any code or event that doesn't allow to open my work book in any
other computer ? Yes i am protected my WB with PW.
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      23rd Dec 2008
Hi,

I doub't there's any foolproff way but you could do this. On closing your
workbook hide all sheets except one with no information in it and have this
in the workbook open event. Substitute xxxx for your computername and note
it's case sensitive.

Private Sub Workbook_Open()
If Environ("Computername") <> "xxxxx" Then
ActiveWorkbook.Close savechanges:=False
Else
For Each Worksheet In ThisWorkbook.Worksheets
Worksheet.Visible = True
Next
End If
End Sub

Mike


"Tufail" wrote:

> hello all,
> is there any code or event that doesn't allow to open my work book in any
> other computer ? Yes i am protected my WB with PW.

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      23rd Dec 2008
I should have added in hiding the sheets you make them very hidden so if the
workbook is opened with macros disabled the user can't unhide them without
access to your project which you have protected.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
For x = 2 To Worksheets.Count
Sheets(x).Visible = xlVeryHidden
Next
End Sub

Mike

"Mike H" wrote:

> Hi,
>
> I doub't there's any foolproff way but you could do this. On closing your
> workbook hide all sheets except one with no information in it and have this
> in the workbook open event. Substitute xxxx for your computername and note
> it's case sensitive.
>
> Private Sub Workbook_Open()
> If Environ("Computername") <> "xxxxx" Then
> ActiveWorkbook.Close savechanges:=False
> Else
> For Each Worksheet In ThisWorkbook.Worksheets
> Worksheet.Visible = True
> Next
> End If
> End Sub
>
> Mike
>
>
> "Tufail" wrote:
>
> > hello all,
> > is there any code or event that doesn't allow to open my work book in any
> > other computer ? Yes i am protected my WB with PW.

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      23rd Dec 2008
Hi Mike, You wrote "Substitute xxxx for your computername and note
it's case sensitive."

Did you mean "Substitute your computername for "xxxx" and note
it's case sensitive"?



"Mike H" wrote:

> Hi,
>
> I doub't there's any foolproff way but you could do this. On closing your
> workbook hide all sheets except one with no information in it and have this
> in the workbook open event. Substitute xxxx for your computername and note
> it's case sensitive.
>
> Private Sub Workbook_Open()
> If Environ("Computername") <> "xxxxx" Then
> ActiveWorkbook.Close savechanges:=False
> Else
> For Each Worksheet In ThisWorkbook.Worksheets
> Worksheet.Visible = True
> Next
> End If
> End Sub
>
> Mike
>
>
> "Tufail" wrote:
>
> > hello all,
> > is there any code or event that doesn't allow to open my work book in any
> > other computer ? Yes i am protected my WB with PW.

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      23rd Dec 2008
That's excatly what I meant, thanks for the correction

"JLGWhiz" wrote:

> Hi Mike, You wrote "Substitute xxxx for your computername and note
> it's case sensitive."
>
> Did you mean "Substitute your computername for "xxxx" and note
> it's case sensitive"?
>
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > I doub't there's any foolproff way but you could do this. On closing your
> > workbook hide all sheets except one with no information in it and have this
> > in the workbook open event. Substitute xxxx for your computername and note
> > it's case sensitive.
> >
> > Private Sub Workbook_Open()
> > If Environ("Computername") <> "xxxxx" Then
> > ActiveWorkbook.Close savechanges:=False
> > Else
> > For Each Worksheet In ThisWorkbook.Worksheets
> > Worksheet.Visible = True
> > Next
> > End If
> > End Sub
> >
> > Mike
> >
> >
> > "Tufail" wrote:
> >
> > > hello all,
> > > is there any code or event that doesn't allow to open my work book in any
> > > other computer ? Yes i am protected my WB with PW.

 
Reply With Quote
 
Tufail
Guest
Posts: n/a
 
      23rd Dec 2008
thank you so much Mike & JLGWhite........

"Mike H" wrote:

> That's excatly what I meant, thanks for the correction
>
> "JLGWhiz" wrote:
>
> > Hi Mike, You wrote "Substitute xxxx for your computername and note
> > it's case sensitive."
> >
> > Did you mean "Substitute your computername for "xxxx" and note
> > it's case sensitive"?
> >
> >
> >
> > "Mike H" wrote:
> >
> > > Hi,
> > >
> > > I doub't there's any foolproff way but you could do this. On closing your
> > > workbook hide all sheets except one with no information in it and have this
> > > in the workbook open event. Substitute xxxx for your computername and note
> > > it's case sensitive.
> > >
> > > Private Sub Workbook_Open()
> > > If Environ("Computername") <> "xxxxx" Then
> > > ActiveWorkbook.Close savechanges:=False
> > > Else
> > > For Each Worksheet In ThisWorkbook.Worksheets
> > > Worksheet.Visible = True
> > > Next
> > > End If
> > > End Sub
> > >
> > > Mike
> > >
> > >
> > > "Tufail" wrote:
> > >
> > > > hello all,
> > > > is there any code or event that doesn't allow to open my work book in any
> > > > other computer ? Yes i am protected my WB with PW.

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      23rd Dec 2008
Glad I could help

"Tufail" wrote:

> thank you so much Mike & JLGWhite........
>
> "Mike H" wrote:
>
> > That's excatly what I meant, thanks for the correction
> >
> > "JLGWhiz" wrote:
> >
> > > Hi Mike, You wrote "Substitute xxxx for your computername and note
> > > it's case sensitive."
> > >
> > > Did you mean "Substitute your computername for "xxxx" and note
> > > it's case sensitive"?
> > >
> > >
> > >
> > > "Mike H" wrote:
> > >
> > > > Hi,
> > > >
> > > > I doub't there's any foolproff way but you could do this. On closing your
> > > > workbook hide all sheets except one with no information in it and have this
> > > > in the workbook open event. Substitute xxxx for your computername and note
> > > > it's case sensitive.
> > > >
> > > > Private Sub Workbook_Open()
> > > > If Environ("Computername") <> "xxxxx" Then
> > > > ActiveWorkbook.Close savechanges:=False
> > > > Else
> > > > For Each Worksheet In ThisWorkbook.Worksheets
> > > > Worksheet.Visible = True
> > > > Next
> > > > End If
> > > > End Sub
> > > >
> > > > Mike
> > > >
> > > >
> > > > "Tufail" wrote:
> > > >
> > > > > hello all,
> > > > > is there any code or event that doesn't allow to open my work book in any
> > > > > other computer ? Yes i am protected my WB with PW.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq to XML--Are there code examples that make Linq as easy as SQL? Or how can I convert ths simple pseudo code into real code? Reece Microsoft C# .NET 4 10th Dec 2008 03:13 AM
ATI Radeon Drivers - Code 43, Code 37 & Code 10 =?Utf-8?B?SmFrZQ==?= Windows Vista Hardware 14 29th Aug 2006 05:50 AM
ATI Display Drivers - Code 43, Code 37, Code 10 Jake Windows Vista Hardware 2 8th Jul 2006 04:00 PM
what is the difference between code inside a <script> tag and code in the code-behind file? keithb Microsoft ASP .NET 1 29th Mar 2006 02:00 AM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:59 PM.