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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error in Excel vbscript

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
US
Hello,

I am receiving a syntax error in the following vbscript

The test run cannot continue due to a syntax error.

Invalid character

Line (1): "set objexcel = Createobject(“Excel.Application”)"

I would also like to use the fieldvalue variable to populate a text file rather than the DataTable references listed below

As I reached a Datable row limitation in Quick Test Professional

' qfile1.Write((DataTable.Value("File_Header_REF7",dtGlobalSheet)))
'
' qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
'
' qfile1.Write((DataTable.Value("REF01_Reference_Identification_Qualifier4",dtGlobalSheet)))
'
' qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
'
' qfile1.Write((DataTable.Value("REF02_Reference_Identification5",dtGlobalSheet)))
'
' qfile1.Write((DataTable.Value("Tilde",dtLocalSheet))) & vbcrlf



Dim objexcel, objWorkbook, objDriverSheet, columncount, rowcount
set objexcel = Createobject(“Excel.Application”)
Set objWorkbook = objExcel.WorkBooks.Open(“\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\DataTable_Spillover.xls”)
Set objDriverSheet = objWorkbook.Worksheets(“Sheet1”)
columncount = objDriverSheet.usedrange.columns.count
rowcount = objDriverSheet.usedrange.rows.count
for i = 1 to columncount
columnname = objDriversheet.cells(i,1)
if columnname = knowncolumnname then
for j = 1 to rowcount
fieldvalue = objdriversheet.cells(j,i)
next
end if
next
 
hi,

In ALL your code...

Your BEGINNING QUOTE is ASCII 147
Your ENDING QUOTE is ASCII 148

QUOTE is ASCII 34.

ASCII 34 is what your complier expects, I do believe.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hello

I was able to correct syntax error - I had cut and pasted code from website




Dim objexcel
Dim objWorkbook
Dim objDriverSheet
Dim columncount
Dim rowcount
set objexcel = Createobject("Excel.Application")
Set objWorkbook = objexcel.WorkBooks.Open("M:\QTP 834\DataTable_Spillover.xls")
Set objDriverSheet = objWorkbook.Worksheets("Sheet1")
columncount = objDriverSheet.usedrange.columns.count
rowcount = objDriverSheet.usedrange.rows.count
for i = 1 to columncount
columnname = objDriversheet.cells(i,1)
if columnname = knowncolumnname then
for j = 1 to rowcount
fieldvalue = objdriversheet.cells(j,i)
next
end if


print "columnname"
print columnname
next


If I want to store the values from the Excel table as an array or as vbscript variables to output - what is the best method based on the code above

Sample table:

File_Header_REF7 REF01_Reference_Identification_Qualifier4 REF02_Reference_Identification5
REF 0F 999999900
REF 0F 999999900
REF 0F 999999900


The input table is being utilized in a script to create an X12 834 transaction for HIX - Health Insurance Exchange
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top