Hey all,
i have a problem here, i want to know how to send value from datagrid to excel
plizzzzz.. help me
Hey all,
i have a problem here, i want to know how to send value from datagrid to excel
plizzzzz.. help me
How far you doing this?
hmm...
i have not started do this project,
i can send datagrid value to txt file, but not to xlx ( excel ) file
i need some reference code
thanks for reply
Okay. This some code :
You need add reference Microsoft Excel Library.
Private Sub Command1_Click()
Dim XcLApp As Object
Dim XcLWB As Object
Dim XcLWS As Object
Set XcLApp = CreateObject("Excel.Application")
Set XcLWB = XcLApp.Workbooks.Add
Set XcLWS = XcLWB.Worksheets.Add
XcLWS.Range(Addres_Excel(1, 1)).Value = "Test string"
XcLApp.Visible = True
'XcLWS.PrintOut
End Sub
Public Function Addres_Excel(ByVal lng_row As Long, ByVal lng_col As Long) As String
Dim modval As Long
Dim strval As String
modval = (lng_col - 1) Mod 26
strval = Chr$(Asc("A") + modval)
modval = ((lng_col - 1) \ 26) - 1
If modval >= 0 Then strval = Chr$(Asc("A") + modval) & strval
Addres_Excel = strval & lng_row
End Function
hmm.., thanks a lot...
how to add excel library..???
Wow..you even don't know how to add reference. :D
Go to Project->Reference->Microsoft Excel 12.0 Object Library
hehe...
i'm newbie programmer , it's my first work using vb6
i only know how to add adodb references
hehe...
thanks a lot,
You're welcome.
Okay don't forget to mark this thread as solved.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.