Hi there,
Hoping someone can help with this vbs problem that has stumped me.
It is used in the Quotation section of JIWA 6.
Code is below and I get a type mismatch error.
Have tried quite a few things but oddly the exact same code in the sales order module works a treat?
'Read csv file and store values in variables
For i = 2 To osheet.usedrange.rows.count
vLineNumber = oSheet.Cells(i,1).Value
vFineLine = oSheet.Cells(i,4).Value
vQty = oSheet.Cells(i,5).Value
vPrice = oSheet.Cells(i,8).Value
'Call function to match value in spreadsheet to corresponding value in internal JIWA SQL database
If GetPartNo(SalesQuoteObject.Database, vFineLine, PartNo, lErrorModule, lErrorMessage) = False
Then
MsgBox lErrorModule & vbCrLf & lErrorMessage & "Line No "&(i-1)
Else
'Begin adding the items on spreadsheet to JIWA Quote
'Line below - in bold - (Line 75) produces error
'Type Mismatch: 'SalesQuoteObject.SalesQuoteLines.AddInventoryItem' at Line 75
'PartNo variable is definitely a string (they all contain text anyway)
ReturnCode = SalesQuoteObject.SalesQuoteLines.AddInventoryItem(PartNo, 1 , NewKey)
SalesQuoteObject.SalesQuoteLines(NewKey).QuantityOrdered = vQty
SalesQuoteObject.SalesQuoteLines(NewKey).SellPriceExGST = vPrice
SalesQuoteObject.SalesQuoteLines(NewKey).LineNumber = vLineNumber
End If
'Note I use EXACT same code in Sales order (except obviously replacing the SalesQuoteObject and SalesQuoteLines object)
'Calling same function. That works perfectly!
Next
Set oSheet = Nothing
oBook.Close
Set oBook = Nothing
oXL.Quit
Set oXL = Nothing
End Sub