Rick Stanich
King and Supreme Ruler
- Local time
- Today, 11:55
- Joined
- May 13, 2009
- Messages
- 93
Please explain how this works?
Can some one help explain how this works?
If that some one has time to add notes to the code.
It works as shown, I'm just not sure how or what happens to the Excel object being created or used.
Hopefully, if I understand it better I may be able to modify this for my use.
All help is appreciated, hints, tips, examples, reading materials...
Can some one help explain how this works?
If that some one has time to add notes to the code.
It works as shown, I'm just not sure how or what happens to the Excel object being created or used.
Hopefully, if I understand it better I may be able to modify this for my use.
Code:
'************ Code Start **********
'This code was originally written by Dev Ashish
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Dev Ashish
'
Sub IsAppRunning()
Dim objXL As Object
Dim strWhat As String, boolXL As Boolean
Dim objActiveWkb As Object
If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If
objXL.Application.workbooks.Add
Set objActiveWkb = objXL.Application.ActiveWorkBook
With objActiveWkb
.Worksheets(1).Cells(1, 1) = "Hello World"
strWhat = .Worksheets(1).Cells(1, 1).Value
End With
objActiveWkb.Close savechanges:=False
If boolXL Then objXL.Application.Quit
Set objActiveWkb = Nothing: Set objXL = Nothing
MsgBox strWhat
End Sub
'************ Code End **********
All help is appreciated, hints, tips, examples, reading materials...
Last edited: