Or, at some point after the statement, 'Set xlApp =
CreateObject("Excel.Application")
', you could insert the statement, xlApp.Visible = TRUE
Furthermore, you said after double-clicking the button ..., try clicking the
button once next time - since your code is behind the click event
This is beyond the issue at hand, however, for efficiency purposes, the
lines :
For Each Cell In xlSheet.Range("A1", "J1")
Cell.Font.Size = 10
Cell.Font.Name = "Arial"
Cell.Font.Bold = True
Cell.Interior.Color = rgb(204, 255, 255)
Cell.HorizontalAlignment = xlHAlignCenter
Cell.WrapText = True
Next
could be replaced with :
With xlSheet.Range("A1:J1")
.Font.Size = 10
.Font.Name = "Arial"
.Font.Bold = True
'etc.
End With
That way, instead of looping 1 time for each cell in the range (10 times),
it is applied to entire range just once
> Hi,
>
[quoted text clipped - 16 lines]
> Cheers
> Steve.
Cire - 19 May 2006 10:55 GMT
>Or, at some point after the statement, 'Set xlApp =
>CreateObject("Excel.Application")
[quoted text clipped - 28 lines]
>> Cheers
>> Steve.
Jon tks for the advice but its running very quickly now so i don't see a
reason to change the code, if its not broke don't fix it! :)
Steve, ur advice! it worked :) although i had to make some changes, instead
of putting it after that line, i used Exit_Handler:
If Not xlSheet Is Nothing Then
Set xlSheet = Nothing
End If
If Not xlBook Is Nothing Then
Set xlBook = Nothing
End If
If Not xlApp Is Nothing Then
xlApp.Quit
Set xlApp = Nothing
End If
If Not mainRst Is Nothing Then
mainRst.Close
Set mainRst = Nothing
End If
If Not mainqdf Is Nothing Then
Set mainqdf = Nothing
End If
If Not maindb Is Nothing Then
Set maindb = Nothing
End If
Exit Sub
Err_Handler:
On Error Resume Next
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler
Resume
End Sub
now it works great :) thanks for ur help.
and couple of other questions, i'm going to use .mdb for my end-users since
my application is a front-end to a ms-sql server so the mdb file is pretty
small. so is there any way to
1. get rid of the security warning at the start?
2. get rid of the access "X" but keep the minimise and maximise? because i've
already programmed a exit application with auto compact code in it so i
wouldnt want to user to exit thru "X" :)