vb6 - RunTime error 1004 Invalid number of arguments

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2007
Posts: 113
Reputation: tgifgemini is an unknown quantity at this point 
Solved Threads: 0
tgifgemini tgifgemini is offline Offline
Junior Poster

vb6 - RunTime error 1004 Invalid number of arguments

 
0
  #1
Sep 12th, 2007
Hello everybody,
my program have been working and today I'm getting run time error 1004 - invalid number of arguments on this line of code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. mystr = "Comments:" & "'" & xlApp.Clean(Trim(rsin![Comments]))

Also, I am getting a "Runtime error 1004 - unable to set the RowHeight Property of the range class" on this code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. RowHeight = .Font.Size * (Len(xlWksht.Range("A" & ii + 1).text) - Len("Comments:")) / w + rht + (rht - .Font.Size) + newlinecnt * .Font.Size

Can anyone tell me what went wrong?

Below is my entire procedure:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. ii = 5
  2. w = 0
  3. For Each R In xlWksht.Range("A8:h8"): w = w + R.ColumnWidth: Next
  4.  
  5. rht = xlWksht.Range("A6").RowHeight
  6.  
  7. Do Until rsin.EOF = True
  8. ii = ii + 2
  9. xlWksht.Cells(ii, 1).Value = rsin![Req No]
  10. xlWksht.Cells(ii, 2).Value = rsin![Description]
  11. xlWksht.Cells(ii, 3).Value = rsin![P L] & Chr(10) & rsin![Pgmr2] & Chr(10) & rsin![Pgmr3]
  12. xlWksht.Cells(ii, 4).Value = rsin![ClientName] & Chr(10) & rsin![Status]
  13. xlWksht.Cells(ii, 5).Value = "-" & Chr(10) & rsin![Per Hrs]
  14. xlWksht.Cells(ii, 6).Value = rsin![Hours] & Chr(10) & rsin![Tot Hrs]
  15. xlWksht.Cells(ii, 7).Value = rsin![Start Date] & Chr(10) & rsin![Start Date]
  16. xlWksht.Cells(ii, 8).Value = rsin![End Date] & Chr(10) & rsin![End Date]
  17. 'xlWksht.Cells(ii + 1, 1).Value = "Comments:" & Chr(10) & "'" & xlApp.Clean(Trim(rsin![Comments]))
  18.  
  19. mystr = "Comments:" & "'" & xlApp.Clean(Trim(rsin![Comments]))
  20. Do
  21. Pos = InStr(Pos + 1, mystr, ":")
  22. If Not Pos = 0 Then
  23. If Mid(mystr, Pos - 5, 1) = "/" Then
  24. mystr = Left(mystr, Pos - 11) & Chr(10) & Mid(mystr, Pos - 10, 10) & Chr(10) & Mid(mystr, Pos + 1)
  25. newlinecnt = newlinecnt + 2
  26. Pos = Pos + 2
  27. End If
  28. End If
  29. Loop While Not Pos = 0
  30. xlWksht.Cells(ii + 1, 1).Value = mystr
  31.  
  32. 'xlWksht.Range("A12").Value = mystr
  33.  
  34. With xlWksht.Range(xlWksht.Cells(ii + 1, 1), xlWksht.Cells(ii + 1, 8))
  35. .HorizontalAlignment = xlLeft
  36. .VerticalAlignment = xlTop
  37. .WrapText = True
  38. .Orientation = 0
  39. .Borders(xlEdgeBottom).LineStyle = xlContinuous
  40. .Borders(xlEdgeBottom).Weight = xlThin
  41. .IndentLevel = 0
  42. .MergeCells = True
  43. .RowHeight = .Font.Size * (Len(xlWksht.Range("A" & ii + 1).text) - Len("Comments:")) / w + rht + (rht - .Font.Size) + newlinecnt * .Font.Size
  44. End With
  45.  
  46. rsin.MoveNext
  47. Loop
Thanks.
tgifgemini
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 113
Reputation: tgifgemini is an unknown quantity at this point 
Solved Threads: 0
tgifgemini tgifgemini is offline Offline
Junior Poster

Re: vb6 - RunTime error 1004 Invalid number of arguments

 
0
  #2
Sep 13th, 2007
Problem solved.
The "Comments" field in my input table had null values, so I fixed it with this code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. If rsin![Comments] = "" Or IsNull(rsin![Comments]) Then
  2. mystr = "Comments:" & Chr(10) & "NO COMMENTS FOR THIS RECORD!"
  3. Else
  4. mystr = "Comments:" & "'" & xlApp.Clean(Trim(rsin![Comments]))
  5. End If
Thanks.
tgif
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC