|
-
May 31st, 2004, 03:00 AM
#1
Thread Starter
Frenzied Member
simple Excel Load question
Hi
Im trying to load Ms Excel on clicking a picture. It seems to be getting something going on click but the Excel Application never gets loaded. Below is my code which seems okey for me. But sure something is wrong. Can somebody check it out for me pls. The reference is there okey. Ths
---------------------------------------------------------
Private Sub Picture3_Click()
Dim objExcel As Excel.Application
Set objExcel = New Excel.Application
Dim objWorkBook As Excel.Workbook
Dim objWorkSheet As Excel.WorkSheet
'make Excel Application load
objExcel.Visible = True
End Sub
-----------------------------------------------------------
-
May 31st, 2004, 07:34 AM
#2
Thread Starter
Frenzied Member
Hi,
Can someone pls tell how
to check if Excel worksheet is running,
also later close it.
-
Jun 1st, 2004, 02:59 AM
#3
Addicted Member
Something like this :-
Code:
Dim xlApp As Object
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then 'Excel Not Active
Err.Clear
Set xlApp = CreateObject("Excel.Application")
End If
Regards
BrianB
-------------------------------
-
Jun 2nd, 2004, 03:03 AM
#4
Thread Starter
Frenzied Member
Hi BrianB,
Thanks loads for your reply. What I really need is;
1. I have instructed the user to open Excel.
2. Then check if he really did the action
3. After checking close it .
But I am getting both messages and the excel is not closing. Can you pls tell me why it is doing this. Your urgent reply is very much appreciated. Thanks.
---------------------------------------------------------------------------
Private Sub Command1_Click()
On Error GoTo IsClosed
If Not Workbooks("Book1") Is Nothing Then
MsgBox "Workbook is open"
Set objExcel = Nothing
Set objWorkBook = Nothing
objExcel.Quit
objWorkBook.Quit
Else
IsClosed: MsgBox "Workbook is not open."
End If
End Sub
--------------------------------------------------------------------------
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
|