Ahhh...
Yes this same procedure should work. Just place it in the "ThisWorkbook"
section of the active workbook and it should perform the same thing, except
for that workbook only...
Mark Ivey
"Oldjay" <(E-Mail Removed)> wrote in message
news:B152ABCE-B27A-42C3-84CD-(E-Mail Removed)...
> What I am attempting to is when a new user (not on my machine) opens this
> Workbook it will add his personal folder to the server. Will your routine
> work under this condition?
>
> oldjay
> "Mark Ivey" wrote:
>
>> Jay,
>>
>> Steve Yandl posted a solution for part of your problem (please scroll
>> down
>> below this post to see his message).
>>
>> To alter what he had a bit and get to what you were wanting, give this a
>> try:
>>
>> In your Personal.xls workbook, put this code into "ThisWorkbook"
>>
>> Private Sub Workbook_Open()
>> user = Application.UserName
>>
>> Set fso = CreateObject("Scripting.FileSystemObject")
>> Set objShell = CreateObject("Shell.Application")
>> Set objFolder = objShell.Namespace("\\server3\jobs\" & user)
>> strUserFolder = objFolder.Self.Path
>>
>> If fso.FolderExists(strUserFolder & "\" & user) Then
>> 'Do something
>> MsgBox "The folder already exists"
>> ElseIf Not fso.FolderExists(strUserFolder & "\" & user) Then
>> Set fldr = fso.CreateFolder(strUserFolder & "\" & user)
>> End If
>>
>> Set objShell = Nothing
>> Set fso = Nothing
>>
>> End Sub
>>
>> ***********************************************************
>> *************** Original Post from Steve Yandl *******************
>> ***********************************************************
>>
>> "Steve Yandl" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Bob,
>> >
>> > Just read your question again and see you also wanted to create the
>> > folder. Try this.
>> >
>> > _____________________________
>> >
>> > Sub FolderToDesk()
>> > Set fso = CreateObject("Scripting.FileSystemObject")
>> > Set objShell = CreateObject("Shell.Application")
>> > Set objFolder = objShell.Namespace(&H10&)
>> > strMyDesk = objFolder.Self.Path
>> >
>> > If Not fso.FolderExists(strMyDesk & "\BlankFolder") Then
>> > Set fldr = fso.CreateFolder(strMyDesk & "\BlankFolder")
>> > End If
>> >
>> > Set objShell = Nothing
>> > Set fso = Nothing
>> > End Sub
>> > ______________________________
>> >
>> > Steve
>>
>>
>>
|