access to a server via a macro

G

Gwyndalf

I manually upload a results sheet to a server - I want to be able to do this
via a macro.
1. Save a particular page as a web page with a pop up for the sheet name

2. Open the FTP server programme and log on using a user name and password

3. Select upload, within the FTP programme, of the file created in '2'

4. Close the ftp programme

Can this be done? Thanks in anticipation
 
P

Patrick Molloy

in the IDE, set a Reference to the 'Microsoft Internet Transfer Control 6.0'
control ( usually C:\Windows\System32\msinet.ocx)

having saved the fille first , now you can send it...

Public Sub FTPtheFile(sFileName As String)
Dim oFTP As FFTPController

sFileName = sRNG_TPFILE

Set oFTP = New FFTPController
With oFTP
.URL = sFTP_URL
.Login = sFTP_USER
.Password = sFTP_PWD
.SourceFile = sFileName
.TargetPath = sFTP_PATH
.Show vbModal
If .FileSent Then
MsgBox "Sent at " & Now()
End If
End With
Unload oFTP

End Sub
 
P

Patrick Molloy

as i copied the code from one of my own code modules, i obviously left some
rubbish in...now its fixed. sorry

Patrick Molloy said:
in the IDE, set a Reference to the 'Microsoft Internet Transfer Control 6.0'
control ( usually C:\Windows\System32\msinet.ocx)

having saved the file first , now you can send it...
Public Sub FTPtheFile(sFileName As String)
Dim oFTP As FFTPController
Set oFTP = New FFTPController
With oFTP
.URL = sFTP_URL
.Login = sFTP_USER
.Password = sFTP_PWD
.SourceFile = sFileName
.TargetPath = sFTP_PATH
.Show vbModal
If .FileSent Then
MsgBox "Sent at " & Now()
End If
End With
Unload oFTP
End Sub
 
G

Gwyndalf

Patrick

Many thanks for your replly; hadn't realised any replies had returned -
hence delay in response.

Can you explain the 'IDE' area where I should reference msinet.ocx?

I usually use a 3rd party FTP uploader (FTP Surfer [Whisper technologies])
was unaware that MS had one built in. (Which is what I assume your code is
using)

My current programme produces the HTML file with a filename based on the
date from a cell within a spreadsheet ie apr24.htm. and saves it in my
documents. Your first line is Sub FTPthe File(sFileName As String) - will
this be requesting the user to input the filename? Since my programme
already knows what the name will be can I not use that information already to
simply upload that file from the saved destination address?

Very grateful for your assistance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top