Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error in .vbs FTP routine invoked from VB 6.0

Status
Not open for further replies.

dgr7

IS-IT--Management
Dec 29, 2006
43
US
Hello,
I’m getting an error when trying to run this VBscript.
Script: (the pathname of the script)
Line: 25
Char: 1
Error: type mismatch: ‘format’
Code: 800a000d
Source: Microsoft vbscript runtime error

I’ve used several .vbs FTP scripts before with no problem, but what’s new/different with this one is that the Upload filename is not static, it’s
L(the current date in mmddyy format)t
for example
L020707t

This VBscript is being invoked from some VB 6.0 code.
In VB 6.0 , I’ve used statements like:
DestinationFile = "D:\BD\HT\NewBusiness\HT" & Format(Date, "mmddyy") & ".txt"
all the time without problem.

My question is:
What format do I need to make the .Upload statement in the .vbs to get it to work
Or if that’s not what needs to be done
Is there a way to pass via variables from vb 6.0 to vbscript the names of the two files to use in the upload statement, so I pass in the L020707t name + the path needed?

Thanks in advance,
david

' VBS Script Generated by CuteFTP (TM) macro recorder.
' Generated, then edited: 02/07/07 by dgr

' Create TEConnection object
Set MySite = CreateObject("CuteFTPPro.TEConnection")

' Initialize remote server host name, protocol, port, etc.
MySite.Host = "ftp.letterlogc.com"
MySite.Protocol = "FTP"
MySite.Port = 21
MySite.Retries = 34
MySite.Delay = 7
MySite.MaxConnections = 4
MySite.TransferType = "ASCII"
MySite.DataChannel = "DEFAULT"
MySite.AutoRename = "OFF"
' WARNING!!! SENSITIVE DATA: user name and password.
MySite.Login = "*******"
MySite.Password = "*******"
MySite.SocksInfo = ""
MySite.ProxyInfo = ""
' Connect to remote server
MySite.Connect
MySite.Upload "D:\DailyLetterRun&RSFUploads\Letters\L" & Format(Date, "mmddyy") & "t", "/L" & Format(Date, "mmddyy") & "t"
MySite.Disconnect
 
Replace this:
Format(Date, "mmddyy")
with this:
Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & Right(Year(Date)),2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV
hello & thank for the quick reply!
I substituted the Format statements with the Right statements as you described, ran the code, and got a new error:
Script: (the pathname of the script)
Line: 25
Char: 133
Error: Expected end of statement
Code: 800A0401
Source: Microsoft VBScript compilation error

and when I used a text editor to see where Char 133 was in line 24, the cursor was between the 2 and ) in the last Right before the & "t", "/L" part.

Please help!

thanks in advance,
david

here's what line 24 now looks like:
MySite.Upload "D:\DailyLetterRun&RSFUploads\Letters\L" & Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & Right(Year(Date)),2) & "t", "/L" & Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & Right(Year(Date)),2) & "t
 
A change to the above that the error is Line: 24 instead of Line:25 where I was describing the error VBscript issued to me, I made a typo...
 
OOps, sorry for the typo :~/
Right("0" & Month(Date),2) & Right("0" & Day(Date),2) & Right(Year(Date),2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
that was it...works great now!
thank you!
david
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top