Export to an network drive

Status
Not open for further replies.

creyn

Board Regular
Joined
Sep 16, 2016
Messages
127
Below is the code I am using to export to a network drive. Can someone help with what I am doing wrong?

Option Compare Database

Private Sub Command2_Click()
Dim MyFolder As String
Dim MyFile As String
Dim MyFolder2 As String
Dim FilePath As String
Dim FileContent As String
Dim TextFile As Integer
Dim MyFile2 As String
Dim fso As Object
Dim sFile As String
Set fso = CreateObject("Scripting.FileSystemObject")
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Show
.InitialFileName = .SelectedItems.Item(1)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * from NewBadRecips"
MyFolder2 = .InitialFileName
MyFile = Dir(MyFolder2)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * from NewBadRecips"
DoCmd.TransferText acImportDelim, "Import Specification", "NewBadRecips", MyFile, True
sFile = "NewBadRecipsQuery.xlsx"
DoCmd.OutputTo acOutputQuery, "NewBadRecipsQuery", "Excel Workbook (*.xlsx)", "\\NAEAST.AD.JPMORGANCHASE.COM\AMERTSS$\TSSTSERV\FLSHARE05\DATA18\LIST MAINTENANCE\FRAUD- RETAIL\CLR Templates" & sFile, True
Name sFile As MyFile
DoCmd.SetWarnings False
MsgBox "Process Complete"
End With
End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Status
Not open for further replies.

Forum statistics

Threads
1,214,386
Messages
6,119,217
Members
448,876
Latest member
Solitario

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