View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Grant Grant is offline
external usenet poster
 
Posts: 17
Default 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