|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello ,
i have a quary i wont to send the result of it to excel file. i find this code from the internet but it won't work... it give me errore Massege " This Command is unavailble becouse the license to use this application has expired" ---------- i put the code in a command button this is the code i use : Private Sub Command1_Click() Dim oXl As Excel.Application Dim oWb As Excel.Workbook Dim oWs As Excel.Worksheet Dim rsR As New ADODB.Recordset Dim i As Integer Dim lWsRow As Long Dim sSQL As String Set oXl = CreateObject("Excel.application") Set oWb = oXl.Workbooks.Add <=== ERROE !!!! Set oWs = oWb.Worksheets(1) oWs.Name = ("ema.xls") sSQL = "Select * from room" rsR.Open sSQL, cnCP, adOpenStatic, adLockReadOnly If Not rsR.EOF Then Do While Not rsR.EOF For i = 0 To rsR.Fields.Count - 1 oWs.Cells(lWsRow, i + 1).Value = rsR.Fields(i) Next i rsR.MoveNext lWsRow = lWsRow + 1 Loop End If rsR.Close Set rsR = Nothing oWb.Close oXl.Quit Set oXl = Nothing End Sub ------------------------- the errore apper in this line==> Set oWb = oXl.Workbooks.Add any idea please ??? Thanks alot ![]() |
|
#2
|
|||
|
|||
|
Helllllllllllllllllllllo
![]() waw ..i fix it ..its working now ...but can any one tell me how can i change the layout of the Excel sheet EX. change the background , add logo (picture)...etc ??? Thanks alot ![]() |
|
#3
|
|||
|
|||
|
helllo,
no one can help me on this !!?? |
|
#4
|
|||
|
|||
|
In Excel start to record a macro and do the thing you want to do - change background, add picture... then look stop the recording and edit the macro command. You will see there how to do same thing in VB.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Help Excel in VB :( |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|