Hi All,
I want to transfer a html file generated by my VB application to my account in Unix Server, please let me know if this is possible and if yes, how can I achieve this?
Thanks in advance!
Hi All,
I want to transfer a html file generated by my VB application to my account in Unix Server, please let me know if this is possible and if yes, how can I achieve this?
Thanks in advance!
Hi Keeda,
Are you transferring the file, or is the VB application? The simplest thing I can think of is if you have Samba installed on the Unix box, you should be able to configure shares that are visible to the Windows box the app is running on, then just save/copy the html file to the share.
Otherwise I think you'd have to invoke an FTP routine (assuming FTP is running as a server on the Unix box) and possible send it that way. Given it sounds like it is a web server, is FTP running on the box? Or maybe scripting or calling SCP (if it's using secure communications)?
Maybe some one else has some thoughts, that's what came to mind for me. I'm only learning .NET myself, so I can't really help with any code, but perhaps this might trigger some discussion or ideas from someone else.
Good luck, Mark
Hi Mark,
Thanks for your reply, I found this below code online from link "http://www.bygsoftware.com/Excel/VBA/ftp.htm",
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, "sftp://mizar.usc.edu"
Print #lInt_FreeFile01, "myusername"
Print #lInt_FreeFile01, "mypassword"
Print #lInt_FreeFile01, "cd mail"
Print #lInt_FreeFile01, "binary"
Print #lInt_FreeFile01, "send " & ThisWorkbook.Path & "\NewsLetter.html"
'' To receive a file, replace the above line with this one
''Print #lInt_FreeFile01, "recv \Picture.gif " & ThisWorkbook.Path & "\Picture.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
but this code give s me an error "Error 5: Invalid procedure call or argument" on line
Shell (strDirectoryList & ".bat"), vbHide '', vbMinimizedNoFocus
would anyone know why is this, I am new to VBA.
Thanks in advance.
if you have a ftp server running on your linux box then why not using:
My.Computer.Network.UploadFile("c:/complete/path/to/file", "ftp://your.url.com/path", "username", "password")
keeda the shell command can only be used to run .exe files you can't run a .bat file using shell
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.