Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 21st, 2003, 12:43 AM
Amerah Amerah is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 Amerah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Help Excel in VB :(

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

Reply With Quote
  #2  
Old December 21st, 2003, 02:34 AM
Amerah Amerah is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 Amerah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face

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

Reply With Quote
  #3  
Old December 22nd, 2003, 11:46 PM
Amerah Amerah is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 3 Amerah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
helllo,
no one can help me on this !!??

Reply With Quote
  #4  
Old January 5th, 2004, 06:07 AM
anca anca is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 30 anca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Help Excel in VB :(


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway