VBA to open SaveAs dialog box in specific folder

Holley

Board Regular
Joined
Dec 11, 2019
Messages
120
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello again! Once again I come asking for your help. I have a macro that does everything I want it to, until the end. The file is being opened on a personal drive (D: ), but I would like to save it on a network drive (G: ). Everything works, even converts from .txt to .xlsx except it keeps opening the dialog box on the personal drive (Drive D where the file originates). This will be ran regularly and will need to be saved on the G drive with the only thing changing is the file name, which is why I want the prompt to open. Any help would be most appreciated. Below is the code I am using. Thank you in advance!!

VBA Code:
Sub KP()
'
' KP Macro
'
' Keyboard Shortcut: Ctrl+Shift+P
'
    Cells.Select
    Selection.Columns.AutoFit
    ActiveSheet.Range("$A$1:$G$126").RemoveDuplicates Columns:=4, Header:=xlYes
    ActiveWorkbook.Worksheets("CUST601").sort.SortFields.Clear
    ActiveWorkbook.Worksheets("CUST601").sort.SortFields.Add2 Key:=Range( _
        "E2:E126"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("kohl601").sort
        .SetRange Range("A1:G126")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Columns("F:F").Select
    Selection.Style = "Currency"
    Range("F3").Select
    Selection.End(xlDown).Select
     Cells.SpecialCells(xlCellTypeVisible)(1).Select
     ChDir "G:\"
    Dim wb As Boolean
       wb = Application.Dialogs(xlDialogSaveAs).Show(File_Name, 51)
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

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