|
-
Jun 26th, 2006, 09:42 AM
#1
Thread Starter
New Member
Pass values from a sheet of excel to a ActiveX control
Hello,
I have a ActiveX control that is a table, and i want to pass the values in the excel sheets to the table of the activeX but the code don't work. Can anybody give me a idea?
Here is the code:
Private Sub DOWNLOAD_Click()
On Error Resume Next
' The required BAPI
Set objTable = Nothing
Set objTeste = objBAPIControl.Add("ZPD_TESTE_EXCEL")
If objTeste.Call Then
Set objTable = objTeste.Tables("T_INTER")
For i = 1 To objTable.RowCount
ActiveSheet.Cells(8 + i, 1) = objTable.Cell(i, 1)
ActiveSheet.Cells(8 + i, 2) = objTable.Cell(i, 2)
ActiveSheet.Cells(8 + i, 3) = objTable.Cell(i, 3)
Next i
Else
MsgBox "Erro a chamar a função."
End If
' objTable.AppendGridData
End Sub
Thanks,
Ricardo
-
Jun 28th, 2006, 03:28 PM
#2
Re: Pass values from a sheet of excel to a ActiveX control
I do it differently - I open the spreadsheet as an ADO database (see http://www.connectionstrings.com/), then do a Select statement to get the data. Then it's easy to assign the data to a control.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jun 28th, 2006, 04:02 PM
#3
Re: Pass values from a sheet of excel to a ActiveX control
Is it me, or are the lines like this..
VB Code:
ActiveSheet.Cells(8 + i, 1) = objTable.Cell(i, 1)
..the wrong way around (you are currently putting the value into Excel).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|