Hi, Hoping someone can help I would like to save a copy of my excel workbook as html then upload all the files (HTML & XLS) to FTP Server. At the min the script I have does save as html however it only sends the .xls file to ftp server. How do I get the html files to send along with the folder that is created when saving as html.
Files to send
NightRota.xls
NightRota.html
-NightRota_files (folder created when saving as html)
--Sheet1
---Sheet2, etc
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
ActiveWorkbook.SaveAs Filename:="NightRota.htm", _
FileFormat:=xlHtml, ReadOnlyRecommended:=False, CreateBackup:=False
'' 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 url"
Print #lInt_FreeFile01, "username"
Print #lInt_FreeFile01, "password"
Print #lInt_FreeFile01, "cd /"
Print #lInt_FreeFile01, "binary"
Print #lInt_FreeFile01, "send " & ThisWorkbook.Path; "\NightRota.xls"
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
Thank You
Bookmarks