ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Active X Control Help (https://www.excelbanter.com/excel-programming/315458-active-x-control-help.html)

Grant

Active X Control Help
 
I am having trouble running the code below. When I run it my message test
tells me I'm connected. But I still get the Run-time error '1004' Method
"Save As' of object _WorkBook failed. I have to go to the Excel open dialog
box and Look in: Add/Modify FTP Locations. Click on ftp selction I want,
then it prompts me to enter User Name and Password. This is what I am trying
to avoid. Maybe I need to use some other way to ftp the file instead of the
SaveAs? How else can I do this?



"Sami Askar" wrote in message
m...
I use an ActiveX control from http://www.chilkatsoft.com/

Set chilkatFTP = CreateObject("ChilkatFTP.ChilkatFTP")

'FTP Parameters
chilkatFTP.Hostname = hostip
chilkatFTP.UserName = username
chilkatFTP.Password = password

'Connect
chilkatFTP.Connect

'Was the connection successful?
If chilkatFTP.IsConnected Then
'lblMessage.Caption = "Connected"
ActiveWorkbook.SaveAs Filename:=
"ftp://123.456.7.89/path/invoice.dat", FileFormat:=xlTextPrinter,
CreateBackup:=False
Else
lblMessage.Caption = "Not connected"
End If






"Grant" wrote in message
...
How can I test to make sure my FTP connection is connected before I
execute
my code.

Thanks
Grant


ActiveWorkbook.SaveAs Filename:= _
"ftp://123.456.7.89/path/invoice.dat", FileFormat:=xlTextPrinter _
, CreateBackup:=False





Stephen Bullen[_4_]

Active X Control Help
 
Hi Grant,

This is what I am trying
to avoid. Maybe I need to use some other way to ftp the file instead of the
SaveAs? How else can I do this?


Just a suggesting, but you could try embedding the username and password in
the ftp location:

ActiveWorkbook.SaveAs "

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk



Grant

Active X Control Help
 
I've tried that and it doesn't work. I get the same run time error.




"Stephen Bullen" wrote in message
...
Hi Grant,

This is what I am trying
to avoid. Maybe I need to use some other way to ftp the file instead of
the
SaveAs? How else can I do this?


Just a suggesting, but you could try embedding the username and password
in
the ftp location:

ActiveWorkbook.SaveAs "

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk





Stephen Bullen[_4_]

Active X Control Help
 
Hi Grant,

I've tried that and it doesn't work. I get the same run time error.


Darn! Then I guess the only choice is to save the file locally, then
transfer it using the FTP control.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk




All times are GMT +1. The time now is 02:21 AM.

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