Hi,

I want to move a fresh copy of a file to a server location every morning when someone clicks on a button. However, even though I have write access to the server, it semms to blocks VBA from being able to do that. I ran several tests and had no problem saving the file to anywhere I wanted on my computer but not the server.


I figure the best work around is to save it to someone's desktop and open the file in the background so they can drag it into the folder. The folder already exists so I just need to open it. Somehow I can't get Shell, ShellExecute, or WinExec to work!

I found the function that, as I understand it, that is needed for an subroutine to work:
Private Declare Function ShellExecute Lib "shell32.dll" _
   Alias "ShellExecuteA" _
  (ByVal hwnd As Long, _
   ByVal lpOperation As String, _
   ByVal lpFile As String, _
   ByVal lpParameters As String, _
   ByVal lpDirectory As String, _
   ByVal nShowCmd As Long) As Long

I found a code and added my own test file location, but it doesn't work:
Public Function ShowBrowse4Folder() As String
    Dim Response As Variant
    Response = BrowseFolder
    If Response = False Then
        MsgBox "You have selected Invalid Folder", vbInformation
    Else
        ShowBrowse4Folder = Response: Exit Function
        MsgBox "Selected Folder - " & Response, vbInformation
    End If
End Function

Private Function BrowseFolder(Optional OpenAt As Variant) As Variant
    Dim ShellApplication As Object
    Set ShellApplication = CreateObject("Shell.Application").BrowseForFolder(0, "C:\Users\aaa001\Documents", 0, OpenAt)
    On Error Resume Next
    BrowseFolder = ShellApplication.self.Path
    Set ShellApplication = Nothing
    Select Case Mid(BrowseFolder, 2, 1)
        Case Is = ":"
        If Left(BrowseFolder, 1) = ":" Then GoTo err1
        Case Is = "\"
        If Not Left(BrowseFolder, 1) = "\" Then GoTo err1
        Case Else
        GoTo err1
    End Select
Exit Function
err1:
BrowseFolder = False
End Function
How do I get this set up so I can open the folder?

Thanks!