ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   access to a server via a macro (https://www.excelbanter.com/excel-programming/423813-access-server-via-macro.html)

Gwyndalf

access to a server via a macro
 
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

Patrick Molloy[_2_]

access to a server via a macro
 
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




"Gwyndalf" wrote:

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


Patrick Molloy[_2_]

access to a server via a macro
 
as i copied the code from one of my own code modules, i obviously left some
rubbish in...now its fixed. sorry

"Patrick Molloy" wrote:

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




"Gwyndalf" wrote:

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


Gwyndalf

access to a server via a macro
 
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

"Patrick Molloy" wrote:

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

"Patrick Molloy" wrote:

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




"Gwyndalf" wrote:

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



All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com