August 7, 2008 at 10:27 am
It changes the file name from BD.txt to something like BD_20080724_061523.txt (you can skip the seconds if you don't need to be that precise).
This is my code but i get error on line 41 which i have highlighted it so please what would be the error in this code very urgent plz
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Set Fso = CreateObject("Scripting.FileSystemObject")
Dim aYear, aMonth, aDay, aDate, aHour, aMin, aTime, aSec
' Format date portion of string......
aYear = Year(Now())
aMonth = Month(Now())
if len(aMonth) = 1 then
aMonth = "0" & aMonth
end if
aDay = Day(Now())
if len(aDay) = 1 then
aDay = "0" & aDay
end if
aDate = aYear & aMonth & aDay
' Format time portion of string......
aHour = Hour(Now())
if len(aHour) = 1 then
aHour = "0" & aHour
end if
aMin = Minute(Now())
if len(aMin) = 1 then
aMin = "0" & aMin
end if
aSec = Second(Now())
if len(aSec) = 1 then
aSec = "0" & aSec
end if
aTime = aHour & aMin & aSec
CopyToSpec = "c:\Output\BD_" & aDate & "_" & aTime & ".txt"
CopyFromSpec = "c:\Output\BD.txt"
[font="Arial Black"] Fso.CopyFile CopyFromSpec, CopyToSpec[/size][/font]
Fso.DeleteFile CopyFromSpec
Main = DTSTaskExecResult_Success
End Function
Thanks,
Chinna
Its the Journey which gives you Happiness not the Destination-- Dan Millman
August 7, 2008 at 10:41 am
I'm guessing the "" is just formatting, but if not, remove that. Also, check if the account you're running the script under has permission to the [font="Courier New"]C:\Output[/font] folder.
Fso.CopyFile CopyFromSpec, CopyToSpec
August 7, 2008 at 10:55 am
It might help if you told us what the error is. Also why don't you just rename the file:
Dim oFile
oFile = FSO.GetFile(CopyFromSpec)
oFile.Name = CopyToSpec
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
August 7, 2008 at 11:00 am
Dim oFile
oFile = FSO.GetFile(CopyFromSpec)
oFile.Name = CopyToSpec
Hello Jack but where exactly should i use this code as i dnt know much abt vb....plz let me know...in this code it doesnt even show my path ...so do i need to include this code in my previous code ..plz let me know...
Thanks,
Chinna
Its the Journey which gives you Happiness not the Destination-- Dan Millman
August 7, 2008 at 11:05 am
Replace your problem code and the delete that follows it with the code I provided.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply