Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Stop an excel file from being moved or copied - do I validate filepath?

Hello

I have an Excel file on a shared drive for everyone to access. Its a sort
of database where everyone keeps adding to it. Originally I set up a
shortcut on all desktops to access the file and all went well.
Lately information was missing, person A said they had entered the details
but when I accessed the file it was not there - somehow they had a copy of
the file on their desktop so the info never reached the file on the shared
drive.

How can I stop my file from being copied or moved. My best thought was to
have some sort of validation on start up, probably checking the filepath was
correct. I dont have a clue how to do this!!

Any assistance or other suggestions would be appreciated.

TIA

Kenny
using XP pro and office 2003


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Stop an excel file from being moved or copied - do I validate filepath?

Hi Kenny

You could use CurDir which will return the directory of the current
file, put it in a string and then check the string against the correct
path if it's correct continue with loading or if not show a msg to the
user and have the book close. the code below should do what you want
though you will have to alter it to your file location details.

Option Explicit
Dim MyLocation As String

Private Sub Workbook_Open()

MyLocation = CurDir

If MyLocation = "//Server/shared_Folder/excel/" Then
'load the database
Else
MsgBox "Your version is incorrect" & vbNewLine _
& "Please contact Me" & vbNewLine _
& "My database will now close", vbCritical
ActiveWorkbook.Saved = True
ActiveWorkbook.Close
End If

End Sub

hope this helps

S

  #3   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default Stop an excel file from being moved or copied - do I validate filepath?

In Workbook_Open:


Const FILE_LOC as String = "\\the\path\to\file.xls"

If ThisWorkbook.Path < FILE_LOC Then
MsgBox "Please use only the file located at " & FILE_LOC
End if


Tim


"N E Body" wrote in message
...
Hello

I have an Excel file on a shared drive for everyone to access. Its a sort
of database where everyone keeps adding to it. Originally I set up a
shortcut on all desktops to access the file and all went well.
Lately information was missing, person A said they had entered the details
but when I accessed the file it was not there - somehow they had a copy of
the file on their desktop so the info never reached the file on the shared
drive.

How can I stop my file from being copied or moved. My best thought was to
have some sort of validation on start up, probably checking the filepath
was correct. I dont have a clue how to do this!!

Any assistance or other suggestions would be appreciated.

TIA

Kenny
using XP pro and office 2003



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
How To Stop Excel Copying Named Functions When A Worksheet Is Copied? Wayne[_3_] Excel Worksheet Functions 2 February 19th 09 02:15 AM
Stop Excel from Formatting Copied Data from Outlook Dan Holt Excel Discussion (Misc queries) 1 October 9th 08 05:29 PM
updating the formula when an excel file is moved. NT1 Excel Discussion (Misc queries) 1 August 8th 07 09:05 AM
How do I stop an Excel file from being copied John Driscoll Excel Discussion (Misc queries) 6 December 15th 05 06:35 PM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM


All times are GMT +1. The time now is 07:34 PM.

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

About Us

"It's about Microsoft Excel"