Here's the code.
Passwords and account names have been changed.
Sub PublishFile()
Dim strDirectoryList As String
Dim lStr_Dir As String
Dim lInt_FreeFile01 As Integer
Dim lInt_FreeFile02 As Integer
On Error GoTo Err_Handler
lStr_Dir = ThisWorkbook.Path
lInt_FreeFile01 = FreeFile
lInt_FreeFile02 = FreeFile
'' ANW 07-Feb-2003 :
strDirectoryList = lStr_Dir & "\Directory"
'' Delete completion file
If Dir(strDirectoryList & ".out") < "" Then Kill (strDirectoryList &
".out")
'' Create text file with FTP commands
Open strDirectoryList & ".txt" For Output As #lInt_FreeFile01
Print #lInt_FreeFile01, "open yoursite.com"
Print #lInt_FreeFile01, "account_name"
Print #lInt_FreeFile01, "account_password"
Print #lInt_FreeFile01, "cd byg/Uploads"
Print #lInt_FreeFile01, "binary"
Print #lInt_FreeFile01, "send " & ThisWorkbook.Path &
"\ftse100_last90.gif ftse100_last90.gif"
Print #lInt_FreeFile01, "bye"
Close #lInt_FreeFile01
'' Create Batch program
Open strDirectoryList & ".bat" For Output As #lInt_FreeFile02
Print #lInt_FreeFile02, "ftp -s:" & strDirectoryList & ".txt"
Print #lInt_FreeFile02, "Echo ""Complete"" " & strDirectoryList &
".out"
Close #lInt_FreeFile02
'' Invoke Directory List generator
Shell (strDirectoryList & ".bat"), vbHide '', vbMinimizedNoFocus
'Wait for completion
Do While Dir(strDirectoryList & ".out") = ""
DoEvents
Loop
Application.Wait (Now + TimeValue("0:00:03"))
'' Clean up files
If Dir(strDirectoryList & ".bat") < "" Then Kill (strDirectoryList &
".bat")
If Dir(strDirectoryList & ".out") < "" Then Kill (strDirectoryList &
".out")
If Dir(strDirectoryList & ".txt") < "" Then Kill (strDirectoryList &
".txt")
bye:
Exit Sub
Err_Handler:
MsgBox "Error : " & Err.Number & vbCrLf & "Description : " &
Err.Description, vbCritical
Resume bye
End Sub
--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
"Rich Cooper" wrote in message
...
Andy could you post the code that creates that txt file? It would be
great
help if you could
"Andy Wiggins" <xx wrote in message
...
I (sometimes) have Excel sending financial data to my web site at:
http://www.bygsoftware.com/Uploads/financial_data.htm
How?
I use the ftp program that comes with my operating systems (W98 and XP)
to
transfer the data.
From within VBA I create a .txt file, which contains the ftp commands.
I run the txt file through .bat file using "Shell".
The ftp commands are in the operating system's help file
--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
"Rich Cooper" wrote in message
...
I am trying to have excel to connect to an ftp with in the company.
But
i
am looking for an approach or a way to do it. I hvae searched on
google
and
there has been very small results. I was wondering if anyone has any
ideas
or has done it and can possibly help and give me some support. I
would
like
excel to be able to upload some information to an ftp and then be able
to
download a some update doctor informaition. But for now i am lokoing
for
a
way to connect to an ftp and be able to upload and download a file.
Any
help would be great