VBA - Save As to Users Downloads Folder

ElvisHess

Board Regular
Joined
May 4, 2006
Messages
150
Hello,

I use the following Code to bring up the SAVE AS dialog box and have a custom file name appear in the File Name field.

The file I am using this with is a template used by many. What I want to do is have the code Point to the specific USERS Downloads folder, then have the user click Save and have the original Template close.

I'm having issues with the code pointing to the downloads directory as the Save As file location. I can't get it to change to even a different folder on C drive.

Sub SaveAs_Click()
Dim ThisFile As String
Sheets("CDR TEMPLATE").Select
ThisFile = Range("'CDR TEMPLATE'!H32").Value & ".xlsm"
Application.Dialogs(xlDialogSaveAs).Show ThisFile
End Sub

Please Help!!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You have to use the environment to get the specific user's download folder path. Also, try using Application.FileDialog instead of Application.Dialog

Code:
Sub SaveAs_Click()
    Dim ThisFile As String
    Dim FolderPath As String

    FolderPath = Environ("HOMEDRIVE") & Environ("HOMEPATH") & "\Downloads"

    Sheets("CDR TEMPLATE").Select
    ThisFile = FolderPath & "\" & Range("'CDR TEMPLATE'!H32").Value & ".xlsm"

    With Application.FileDialog(msoFileDialogSaveAs)
        .AllowMultiSelect = False
        .InitialFileName = ThisFile
        .Show
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,070
Messages
6,128,614
Members
449,460
Latest member
jgharbawi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top