UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Test for file location with ThisWorkbook.Path (incomplete)    
 
   
carolel
post Jan 18 2007, 04:35 AM
Post #1

UtterAccess Guru
Posts: 662
From: Devon, UK



I want to prevent code in the Workbook_Open module running if the file is not in a specific location – i.e. if it’s been emailed to someone else or copied.

Is it possible to use ThisWorkbook.Path without specifying the whole path? The original file will be in one of various subfolders, so the first part will not change. I tried it using a wildcard but it doesn't work – something like this:

If ThisWorkbook.Path <> "K:\Shared\Reports\Sales\*" Then
Exit Sub
End If

(where * would be a monthly folder)

BTW this is not a security issue, I just don’t want recipients to see the user options msgbox when they open the file.

Thanks
Carole
Go to the top of the page
 
+
StuKiel
post Jan 18 2007, 06:00 AM
Post #2

UtterAccess Ruler
Posts: 1,182
From: Norfolk UK



Hi Carole,

You can do this using the Like operator:

If ThisWorkbook.Path Like "K:\Shared\Reports\Sales\*" Then


Stu.
Go to the top of the page
 
+
carolel
post Jan 18 2007, 06:24 AM
Post #3

UtterAccess Guru
Posts: 662
From: Devon, UK



Thanks Stu, great help (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif)

Carole
Go to the top of the page
 
+
StuKiel
post Jan 18 2007, 06:53 AM
Post #4

UtterAccess Ruler
Posts: 1,182
From: Norfolk UK



Glad you like it.

Good luck.

Stu.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 11:42 PM