Is it possible to capture the selected location from a SaveAs dialogue box when downloading a file and insert that information into a textbox>
Is it possible to capture the selected location from a SaveAs dialogue box when downloading a file and insert that information into a textbox>
[VBA]Sub test()
Dim savepath
savepath = Application.GetSaveAsFilename
TextBox1.Value = savepath
End Sub
[/VBA]
[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?
Immediatly after the SaveAs has been performed, ActiveWorkbook.Path should get you where the newly named file is to be found.
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