Open file from a fixed directory

V

vicenflor

Hello,

For my application I'm looking for some code to open one of the files in a
fixed directory "bewaardirectorie". The user must be able to select the file
he's looking for. Now I'm using the code, but the problem with this code is
that one is still able to select another directory :

With Dialogs(wdDialogFileOpen)
ChangeFileOpenDirectory Bewaardirectorie

If .Show Then
Openfile = WordBasic.filenameinfo$(.Name, 1)
Else
'ActiveDocument.Protect _
' Type:=wdAllowOnlyFormFields, _
' NoReset:=True
Exit Sub
End If
End With


Any suggestions are welcome.

Vicenflor
 
J

Jezebel

Instead of using the built-in dialog, add a UserForm and use the
CommonDialog control. (You can use the control without displaying the form
itself, so the user won't notice a change.) CommonDialog has a Flags setting
that prevents the user changing to another directory.

But bear in mind that there's no method to achieve *enforcable* security.
The user can work around your macro if they wish; so it might be simpler
just to *ask* them to use your preferred directory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top