Consulting

Results 1 to 5 of 5

Thread: Solved: caption SaveAs location

  1. #1

    Solved: caption SaveAs location

    Is it possible to capture the selected location from a SaveAs dialogue box when downloading a file and insert that information into a textbox>

  2. #2
    VBAX Mentor
    Joined
    Feb 2009
    Posts
    493
    Location
    [VBA]Sub test()
    Dim savepath
    savepath = Application.GetSaveAsFilename
    TextBox1.Value = savepath

    End Sub

    [/VBA]

  3. #3
    [VBA]Public Declare Function DoFileDownload Lib "shdocvw.dll" _
    (ByVal lpszFile As String) _
    As Long

    Sub sDownloadHTTP(strURL As String)
    strURL = StrConv(strURL, vbUnicode)
    DoFileDownload (strURL)
    End Sub

    Sub AutoDownloadIntranetFile()
    sDownloadHTTP "http://www.mywebsite.com//Files/file.xls"
    End Sub
    [/VBA]


    Well, I'm tried that, but since I'm calling the SaveAs dialogue box via a code, how do i get from there?

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Immediatly after the SaveAs has been performed, ActiveWorkbook.Path should get you where the newly named file is to be found.

  5. #5
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,745
    Location
    Maybe you can use the FileDialog object

    I've never tried using it on another file, but maybe you can get it to do what you want

    [VBA]
    Sub MyFileSaveAs()

    Dim fd As FileDialog
    Set fd = Application.FileDialog(msoFileDialogSaveAs)
    With fd
    'Use the Show method to display the File Picker dialog box and return the user's action.
    'The user pressed Save
    If .Show = -1 Then
    MsgBox "The path is: " & .SelectedItems(1)
    'The user pressec Cancel
    Else
    MsgBox "Canceled"
    End If

    End With
    'Set the object variable to Nothing.
    Set fd = Nothing
    End Sub
    [/VBA]

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •