Question Open a specific Windows Folder

DREAMERMX

Registered User.
Local time
Today, 07:54
Joined
Aug 14, 2013
Messages
20
Open a specific Windows Folder

Hello everyone!

I am using this code to open a specific Windows folder ..... and it works perfect:
----------------------------------------------------------------------------------------
As String Dim folder
folder = "c: \ Documents WORD"
Dim Retval
Retval = Shell ("explorer.exe / e, / root," "" & folder & "" "", 1)
----------------------------------------------------------------------------------------

... but also need to open in the specified path, taking the data "UserName" of one field in a table:

TABLE: "Assignments" IDEExp, UserName, Date

So instead of going to the folder = "c:\Documents WORD" would go to: c: \Documents WORD\UserName "

PS: In Windows and subfolders are created with UserName1, 2,3,4, etc.

I hope you can help me
Thank you!
DMX. -
 
Build the folder name in parts.
folder = "C:\Documents WORD\" & Me.UserName

This assumes the UserName is a control on your form.
 
Build the folder name in parts.
folder = "C:\Documents WORD\" & Me.UserName

This assumes the UserName is a control on your form.

Hello, thank for reply!

no way! adding &Me.Username, open the folder "My Documents", not the folder with the name of the field.

UserName is a combobox was created with the wizard searches (taking data from another table "People"), in the design of the table, will be for that?


Help!!

Thanks
 
Try This!

folder = "C:\Documents WORD\" & Me.UserName.Column(2)
 
Try This!

folder = "C:\Documents WORD\" & Me.UserName.Column(2)

Thank for reply!

NO WAY ... I try this:

Private Sub Comando26_Click()
Dim carpeta As String
carpeta = "P:\Documents WORD" & Me.[Assigned to:].Column(2)
Dim Retval
Retval = Shell("explorer.EXE /e, /root, """ & carpeta & """", 1)
End Sub

... and sends me to "P:\Documents WORD" but not, for example, P:\Documents WORD\James Brown

It is clear that, the folders with the names of the ComboBox and are created in the path P:\Documents WORD\Usernames ...
 
Hmm, you forgot a back slash...

change this...

Code:
carpeta = "P:\Documents WORD" & Me.[Assigned to:].Column(2)

to this...

Code:
carpeta = "P:\Documents WORD\" & Me.[Assigned to:].Column(2)
 
Since you have spaces in the (Assigned to) string try this:

carpeta = "P:\Documents WORD\" & """ & Me.[Assigned to:].Column(2) & """
 
Solved!

The problem was the \ and the number of the bound column ... was in my nostrils :banghead: LOL

Thanks to everyone!!!!
 

Users who are viewing this thread

Back
Top Bottom