Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Disable spreadsheet when copied to incorrect file path or differen ip address

I have password protected the worksheets and VB code and disabled the
saving function. Still, the program can be copied and pasted to
another location. Is there a way to implement a macro that will disble
the spread sheet if is in an incorrect file location or an incorrect
IP address?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,514
Default Disable spreadsheet when copied to incorrect file path or differen ip address

Schatzi wrote :
I have password protected the worksheets and VB code and disabled the
saving function. Still, the program can be copied and pasted to
another location. Is there a way to implement a macro that will disble
the spread sheet if is in an incorrect file location or an incorrect
IP address?


You can check 'ThisWorkbook.Path' on startup for the expected string
value and if not correct then 'ThisWorkbook.Close'!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Disable spreadsheet when copied to incorrect file path ordifferen ip address

I tried using the code:
MyFullName = ThisWorkbook.FullName
ActiveWorkbook.Close False

I'm not sure where I need to import the correct path. I have this in
the Auto_open sub.

On Apr 28, 3:59*pm, GS wrote:
Schatzi wrote :

I have password protected the worksheets and VB code and disabled the
saving function. Still, the program can be copied and pasted to
another location. Is there a way to implement a macro that will disble
the spread sheet if is in an incorrect file location or an incorrect
IP address?


You can check 'ThisWorkbook.Path' on startup for the expected string
value and if not correct then 'ThisWorkbook.Close'!

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,514
Default Disable spreadsheet when copied to incorrect file path or differen ip address

on 4/28/2011, Schatzi supposed :
I tried using the code:
MyFullName = ThisWorkbook.FullName
ActiveWorkbook.Close False

I'm not sure where I need to import the correct path. I have this in
the Auto_open sub.

On Apr 28, 3:59*pm, GS wrote:
Schatzi wrote :

I have password protected the worksheets and VB code and disabled the
saving function. Still, the program can be copied and pasted to
another location. Is there a way to implement a macro that will disble
the spread sheet if is in an incorrect file location or an incorrect
IP address?


You can check 'ThisWorkbook.Path' on startup for the expected string
value and if not correct then 'ThisWorkbook.Close'!

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


You should know where the project is to be stored. It's not some value
that you retrieve somehow; it's a deliberately decided location.

You could store the correct path in a constant, the Registry, or a file
in the same folder as the project. In fact, you don't even need to
store the path because you could use a dummy file in the same folder
and check if that exists at startup. Users will not likely know that
this file is needed and so would copy/saveas the workbook only.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Disable spreadsheet when copied to incorrect file path ordifferen ip address

On Apr 28, 5:09*pm, GS wrote:
on 4/28/2011, Schatzi supposed :





I tried using the code:
MyFullName = ThisWorkbook.FullName
ActiveWorkbook.Close False


I'm not sure where I need to import the correct path. I have this in
the Auto_open sub.


On Apr 28, 3:59*pm, GS wrote:
Schatzi wrote :


I have password protected the worksheets and VB code and disabled the
saving function. Still, the program can be copied and pasted to
another location. Is there a way to implement a macro that will disble
the spread sheet if is in an incorrect file location or an incorrect
IP address?


You can check 'ThisWorkbook.Path' on startup for the expected string
value and if not correct then 'ThisWorkbook.Close'!


--
Garry


Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


You should know where the project is to be stored. It's not some value
that you retrieve somehow; it's a deliberately decided location.

You could store the correct path in a constant, the Registry, or a file
in the same folder as the project. In fact, you don't even need to
store the path because you could use a dummy file in the same folder
and check if that exists at startup. Users will not likely know that
this file is needed and so would copy/saveas the workbook only.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

- Show quoted text -


I was able to use this code and it works great. It does check where
the file is stored and makes sure it matches up with where I want it
to be stored:

Private Sub Workbook_Open()
FullPath = ThisWorkbook.FullName
If FullPath < "c:\test.xls" Then
MsgBox "This file can only be accessed from the server: " +
FullPath, vbExclamation, "Access Denied"
ActiveWorkbook.Close False
End If
End Sub

Thanks for your help.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a function to print file name/path on a spreadsheet? cchas80860 Excel Worksheet Functions 4 April 14th 09 02:35 AM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
Excel 2003 link path is incorrect rykkim Setting up and Configuration of Excel 0 January 13th 06 07:02 PM
how to merge 2 different versions of same file edited on differen. justinfisher Excel Discussion (Misc queries) 0 January 21st 05 08:49 PM
Change Path names in copied work book jheaney Excel Worksheet Functions 2 November 18th 04 07:29 PM


All times are GMT +1. The time now is 11:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"