VBA Network filepath

Neilster

Registered User.
Local time
Yesterday, 23:59
Joined
Jan 19, 2014
Messages
218
Hi Guys

I've touched on this topice previouly however to no avail, but I really need some help on this.

In the DB the user can click a button which opens up a word doc which is stored in a folder along with the DB. The DB is stored on a shared drive (Network) and will be used in different locations.

So I have tried the below code so that the button works on any PC and any Network but its not working, Please please help. :banghead: :banghead:

Dim sUsername As String
Dim filesPath As String

sUsername = Environ$("username")
filesPath = Environ$("USERPROFILE") & "\\" & "\\USER32\Users\Public\AdminFolder\Template.docx"
 
looks like you have too many backslashes. I would go to windows explorer, navigate to the location and copy the path, then compare with what you are creating
 
Hi CJ

Thanks for getting back to me, explorer gives me this

\\User32\Users\Public\Adminfolder\Template.docx
 
so why do you need the environ values when they are not used (you are in a public directory as highlighted in red). All you should need is

filesPath = "\\USER32\Users\Public\AdminFolder\Template.docx"
 

Users who are viewing this thread

Back
Top Bottom