I have the following code I need modified to save a text file to an FTP site. The FTP site is saved to my computer. The current code looks into an existing column for the value "1" and if that exists, the code captures the data in a cell several columns over. Then it pops up a save dialog.
What I want to happen is that the file is saved automatically without the dialog box to an FTP site.
This is the file path:
ftp://[url removed, login to view]
This has been attempted by someone with basic VBA skills, but he ran into a problem saving to an FTP site.
Currently, when the Save dialogue box opens and I try to save to the FTP site I get this error:
"Bad file name or number"
The code is below:
Dim r As Range
Dim c As Range
Dim OutputFileNum As Integer
Dim PathName As String
Dim RowNum As Integer
Dim SheetValues() As Variant
Dim filePathVariant As Variant
' displays the save file dialog
filePathVariant = [url removed, login to view]( _
FileFilter:="Text Files (*.txt), *.txt")
' checks to make sure the user hasn't canceled the dialog
If filePathVariant <> False Then
PathName = filePathVariant
OutputFileNum = FreeFile
Open PathName For Output Lock Write As #OutputFileNum
Set r = [url removed, login to view]([url removed, login to view]("AX8"), [url removed, login to view]("AW8").End(xlDown))
For Each c In [url removed, login to view]
If [url removed, login to view] = 50 And [url removed, login to view] = 1 Then
Print #OutputFileNum, [url removed, login to view]([url removed, login to view], 41).Value
12 freelancers are bidding on average €126 for this job
VBA is a obsolete technology. You should use VB.Net or C# to create program which can solve your problem easily. Thanks. Relevant Skills and Experience C#, Vb.Net programmer. Proposed Milestones €200 EUR - Milestone