here is my script, when i open the text file and i look where its supposed to be the zero, i find nothing
myDateString0 = FormatDateTime(Date(), 0)
arrdate = split(myDateString0,"/")
if arrdate(1) < 10 then
strdate = "0" & arrdate(1)
else
strdate = arrdate(1)
end if
if arrdate(0) < 10 then
stryear = "0" & arrdate(0)
else
stryear = arrdate(0)
end if
strfolderdate = stryear & "-" & strdate & "-" & arrdate(2)
strfolderyear = arrdate(2)
textpath ="G:\Update\" & strfolderyear &"\" & strfolderdate &"\"
Const adReadOnly = 1
Const adOpenForwardOnly = 0
Const adCmdText = &H0001
Const ForWriting= 2
Spreadsheet = textpath & "krtest.xlsm"
Const Worksheet = "Sheet2"
strFile = textpath & "FromExcel.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(Spreadsheet) Then
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Spreadsheet & ";Extended Properties=Excel 12.0;"
objRecordset.Open "Select * FROM [" & Worksheet & "$A:I]", objConnection, adOpenForwardOnly, adReadOnly, adCmdText
Set objFile=objFSO.OpenTextFile(strFile, ForWriting, True)
Do Until objRecordSet.EOF
sku = objRecordSet.Fields(0).Value
description = objRecordSet.Fields(1).Value
size = objRecordSet.Fields(3).Value
qty = objRecordSet.Fields(5).Value
price = objRecordSet.Fields(6).Value
arrsku = split(sku,"-")
goodsku = arrsku(0) & arrsku(1)
if qty = "OUT" then qty = "0"
strline = goodsku & vbtab & description & vbtab & size & vbtab & qty & vbtab & price
If IsNull(strline) = False Then
objFile.WriteLine strline
End If
objRecordSet.MoveNext
strline = ""
Loop
objFile.Close
objConnection.Close
End If
wscript.echo "Done..."