Asked by:
How to get all the Parameters of my file ?

Question
-
Hello,
I have the below VBScript;
row=8 Do While ((row < 21) AND (row <> 17) AND (row <> 12)) col=5 PARAM_POC=Replace(objXLWs.Cells(row, 1).Text,vbLf,"<br>") if row = 8 then PARAM_POC="Sales with Warranty" end if if row = 9 then PARAM_POC="Cost of Sales with Warranty" end if if row = 10 then PARAM_POC="Gross Profit with Warranty" end if if row = 11 then PARAM_POC="Gross Profit with Warranty in % of Sales" end if if row=13 then PARAM_POC="Warranty Cost" end if if row=14 then PARAM_POC="Warranty as % of Cost" end if if row=15 then PARAM_POC="GP without Warranty Cost" end if if row=16 then PARAM_POC="GP% without Warranty" end if if row=18 then PARAM_POC="ERP COG" end if if row=19 then PARAM_POC="ERP Cost of Sales" end if if row=20 then PARAM_POC="Check Warranty" end if Header_1_POC="Order Entry Calc" Header_2_POC="Budget" Value_POC=Replace(objXLWs.Cells(row, col).Text,vbLf,"<br>") All_Record_POC= Project_Number & delimter & PARAM_POC & delimter & Header_1_POC & delimter & Header_2_POC & delimter & Value_POC &delimter&Region&delimter&Customer_Name&delimter&objFile.Name filetxt_POC.WriteLine(All_Record_POC) row = row + 1 Loop
My output shows only Param_POC = "Sales with Warranty", "Cost of Sales with Warranty", "Gross Profit with Warranty", "Gross Profit with Warranty in % of Sales" only.
What I am doing wrong in my script?
thanks
Bhavesh
- Moved by Bill_Stewart Thursday, December 13, 2018 3:26 PM Unanswerable drive-by question
Thursday, September 20, 2018 1:52 PM
All replies
-
You need to fix you syntax. If you place the code on the "if" line then you cannot use "End If"
This:
if row = 8 then PARAM_POC="Sales with Warranty"
or this:
if row = 8 then
PARAM_POC="Sales with Warranty"
end ifA "Select" statement would be cleaner.
\_(ツ)_/
- Edited by jrv Thursday, September 20, 2018 5:56 PM
Thursday, September 20, 2018 5:56 PM -
I have used the below code, but still, all parameters are not populating.
row=8
Do While ((row < 21) AND (row <> 17) AND (row <> 12))
col=5
PARAM_POC=Replace(objXLWs.Cells(row, 1).Text,vbLf,"<br>")
if row = 8 then
PARAM_POC="Sales with Warranty"
end if
if row = 9 then
PARAM_POC="Cost of Sales with Warranty"
end if
if row = 10 then
PARAM_POC="Gross Profit with Warranty"
end if
if row = 11 then
PARAM_POC="Gross Profit with Warranty in % of Sales"
end if
if row=13 then
PARAM_POC="Warranty Cost"
end if
if row=14 then
PARAM_POC="Warranty as % of Cost"
end if
if row=15 then
PARAM_POC="GP without Warranty Cost"
end if
if row=16 then
PARAM_POC="GP% without Warranty"
end if
if row=18 then
PARAM_POC="ERP COG"
end if
if row=19 then
PARAM_POC="ERP Cost of Sales"
end if
if row=20 then
PARAM_POC="Check Warranty"
end if
Header_1_POC="Order Entry Calc"
Header_2_POC="Budget"
Value_POC=Replace(objXLWs.Cells(row, col).Text,vbLf,"<br>")
All_Record_POC= Project_Number & delimter & PARAM_POC & delimter & Header_1_POC & delimter & Header_2_POC & delimter & Value_POC &delimter&Region&delimter&Customer_Name&delimter&objFile.Name
' Wscript.Echo All_Record_POC
'filetxt.WriteLine(All_Record_POC)
filetxt_POC.WriteLine(All_Record_POC)
row = row + 1
Loop
Thursday, September 20, 2018 7:15 PM -
What parameters are you referring to?
If you do not know VBScript then you should be using PwoerShell. Don't waste time trying to learn an obsolete tool.
\_(ツ)_/
Thursday, September 20, 2018 7:18 PM