however, with PowerPoint there is no difference between if I use
set PowerPoint Var = CreateObject("PowerPoint .Applicaton")
or
set PowerPoint Var = GetObject(,"PowerPoint .Applicaton")
Can someone explain me why this happens and how I cand solve this issue?
Thank you in advance
Galin Iliev
MCSD
"Galin Iliev" <test@AVOID_SPAM@galcho.com> wrote in message
news:OAEoWo0P...@TK2MSFTNGP11.phx.gbl...
Public Sub MultiplePowerpoints()
Dim appPowerpoint As PowerPoint.Application
Dim appPowerpointAnother As PowerPoint.Application
Dim appWord As Word.Application
Dim blnPPTRunning As Boolean
On Error Resume Next
Set appPowerpoint = GetObject(Class:="PowerPoint.Application")
If appPowerpoint Is Nothing Then
' Powerpoint not running, create instance of Powerpoint
blnPPTRunning = False
Err.Clear
Set appPowerpoint = New PowerPoint.Application
MsgBox "Creating first instance of Powerpoint", vbOKOnly,
"Powerpoint was not already running"
Else
blnPPTRunning = True
MsgBox "Using running instance of Powerpoint", vbOKOnly, "Powerpoint
was already running"
End If
With appPowerpoint
.Visible = msoTrue
.WindowState = ppWindowMinimized
End With
' Create another instance of Powerpoint
Set appPowerpointAnother = New PowerPoint.Application
If appPowerpointAnother Is Nothing Then
With Err
MsgBox .Number & ": " & .Description, vbOKOnly, "Could not
create second instance of Powerpoint"
End With
Else
MsgBox "OK!", vbOKOnly, "Created second instance of Powerpoint"
With appPowerpointAnother
.Visible = msoTrue
.WindowState = ppWindowMinimized
End With
End If
'If this code started PowerPoint
If blnPPTRunning = False Then
If vbYes = MsgBox("Select Yes to kill the First instance of
Powerpoint", vbYesNo, _
"Powerpoint hit squad needs your instructions") Then
appPowerpoint.Quit
End If
End If
If vbYes = MsgBox("Select Yes to kill the second instance of
Powerpoint", vbYesNo, _
"Powerpoint hit squad needs your instructions") Then
appPowerpointAnother.Quit
End If
' Create another instance of Word
' Do not kill
Set appWord = New Word.Application
If appWord Is Nothing Then
With Err
MsgBox .Number & ": " & .Description, vbOKOnly, "Could not
create second instance of Word"
End With
Else
MsgBox "OK!", vbOKOnly, "Created second instance of Word"
With appWord
.Visible = msoTrue
.WindowState = wdWindowStateMinimize
End With
End If
Set appPowerpoint = Nothing
Set appPowerpointAnother = Nothing
Set appWord = Nothing
End Sub
--
http://www.standards.com/; See Howard Kaikow's web site.
Note: I am with PowerPoint XP
Thank you for cooperation
Galin Iliev
MCSD
Option Explicit
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd
As Long, lpdwProcessId As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Public Sub MultiplePowerpoints()
Dim appPowerpoint As PowerPoint.Application
Dim appPowerpointAnother As PowerPoint.Application
Dim appWord As Word.Application
Dim blnPPTRunning As Boolean
Dim lFirstID As Long
Dim lSecondID As Long
Dim lFirstHandle As Long
Dim lSecondHandle As Long
On Error Resume Next
Set appPowerpoint = GetObject(Class:="PowerPoint.Application")
If appPowerpoint Is Nothing Then
' Powerpoint not running, create instance of Powerpoint
blnPPTRunning = False
Err.Clear
Set appPowerpoint = New PowerPoint.Application
MsgBox "Creating first instance of Powerpoint", vbOKOnly, _
"Powerpoint was not already running"
Else
blnPPTRunning = True
MsgBox "Using running instance of Powerpoint", vbOKOnly, "Powerpoint
was already running"
End If
With appPowerpoint
.Visible = True
.Activate
lFirstHandle = GetForegroundWindow()
.WindowState = ppWindowMinimized
End With
' Create another instance of Powerpoint
Set appPowerpointAnother = New PowerPoint.Application
If appPowerpointAnother Is Nothing Then
With Err
MsgBox .Number & ": " & .Description, vbOKOnly, "Could not
create second instance of Powerpoint"
End With
Else
MsgBox "OK!", vbOKOnly, "Created second instance of Powerpoint"
With appPowerpointAnother
.Visible = True
.Activate
lSecondHandle = GetForegroundWindow()
.WindowState = ppWindowMinimized
End With
End If
'Check processes IDs
GetWindowThreadProcessId lFirstHandle, lFirstID
GetWindowThreadProcessId lSecondHandle, lSecondID
If lFirstID = lSecondID Then MsgBox "appPowerpoint and appPowerpoint
hold same process!"
'If this code started PowerPoint
If blnPPTRunning = False Then
If vbYes = MsgBox("Select Yes to kill the First instance of
Powerpoint", vbYesNo, _
"Powerpoint hit squad needs your instructions") Then
appPowerpoint.Quit
End If
End If
If vbYes = MsgBox("Select Yes to kill the second instance of
Powerpoint", vbYesNo, _
"Powerpoint hit squad needs your instructions") Then
appPowerpointAnother.Quit
End If
' Create another instance of Word
' Do not kill
Set appWord = New Word.Application
If appWord Is Nothing Then
With Err
MsgBox .Number & ": " & .Description, vbOKOnly, "Could not
create second instance of Word"
End With
Else
MsgBox "OK!", vbOKOnly, "Created second instance of Word"
With appWord
.Visible = True
.WindowState = wdWindowStateMinimize
End With
End If
Set appPowerpoint = Nothing
Set appPowerpointAnother = Nothing
Set appWord = Nothing
End Sub
"Howard Kaikow" <kai...@standards.com> wrote in message
news:e8vvCPLQ...@tk2msftngp13.phx.gbl...
Option Explicit
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd
As Long, lpdwProcessId As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Public Sub MultiplePowerpointsHandles()
Dim appPowerpoint As Powerpoint.Application
Dim appPowerpointAnother As Powerpoint.Application
Dim appWord As Word.Application
Dim blnPPTRunning As Boolean
Dim lngHandle1 As Long
Dim lngHandle2 As Long
Dim lngHandleWord As Long
Dim lngPID1 As Long
Dim lngPID2 As Long
lngHandleWord = GetForegroundWindow()
On Error Resume Next
Set appPowerpoint = GetObject(Class:="PowerPoint.Application")
If appPowerpoint Is Nothing Then
' Powerpoint not running, create instance of Powerpoint
blnPPTRunning = False
Err.Clear
Set appPowerpoint = New Powerpoint.Application
MsgBox "Creating first instance of Powerpoint", vbOKOnly, _
"Powerpoint was not already running"
Else
blnPPTRunning = True
MsgBox "Using running instance of Powerpoint", vbOKOnly, "Powerpoint
was already running"
End If
With appPowerpoint
.Visible = True
.Activate
lngHandle1 = GetForegroundWindow()
.WindowState = ppWindowMinimized
End With
' Create another instance of Powerpoint
Set appPowerpointAnother = New Powerpoint.Application
If appPowerpointAnother Is Nothing Then
With Err
MsgBox .Number & ": " & .Description, vbOKOnly, "Could not
create second instance of Powerpoint"
End With
Else
MsgBox "OK!", vbOKOnly, "Created second instance of Powerpoint"
With appPowerpointAnother
.Visible = True
.Activate
lngHandle2 = GetForegroundWindow()
.WindowState = ppWindowMinimized
End With
'Check processes IDs
GetWindowThreadProcessId lngHandle1, lngPID1
GetWindowThreadProcessId lngHandle2, lngPID2
If lngPID1 = lngPID2 Then
MsgBox "Both instances of Powerpoint use the same process.",
vbOKOnly, _
"Powerpoint"
Else
MsgBox "Each instance of Powerpoint uses a different
process.", vbOKOnly, _
"Powerpoint"
End If
If vbYes = MsgBox("Select Yes to kill the second instance of
Powerpoint", vbYesNo, _
"Powerpoint hit squad needs your instructions") Then
appPowerpointAnother.Quit
End If
End If
'If this code started PowerPoint
If blnPPTRunning = False Then
If vbYes = MsgBox("Select Yes to kill the First instance of
Powerpoint", vbYesNo, _
"Powerpoint hit squad needs your instructions") Then
appPowerpoint.Quit
End If
End If
' Create another instance of Word
Set appWord = New Word.Application
If appWord Is Nothing Then
With Err
MsgBox .Number & ": " & .Description, vbOKOnly, "Could not
create second instance of Word"
End With
Else
MsgBox "OK!", vbOKOnly, "Created second instance of Word"
With appWord
.Visible = True
.Activate
lngHandle2 = GetForegroundWindow()
.WindowState = wdWindowStateMinimize
'Check processes IDs
GetWindowThreadProcessId lngHandleWord, lngPID1
GetWindowThreadProcessId lngHandle2, lngPID2
If lngPID1 = lngPID2 Then
MsgBox "Both instances of Word use the same process.",
vbOKOnly, _
"Word"
Else
MsgBox "Each instance of Word uses a different process.",
vbOKOnly, _
"Word"
End If
.Quit
Galin Iliev
MCSD
"Howard Kaikow" <kai...@standards.com> wrote in message
news:uspSeBd...@TK2MSFTNGP09.phx.gbl...
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article <1FBFB915-B226-4635...@microsoft.com>,
som...@example.com says...
> I installed Microsoft Office 2000 a couple years ago. I never really used it b/c it was on my home computer and I rarely turned my home computer on.
>
> Here's the deal. I recently took on a new job which requires me to use a ton of power point presentations. I'm supposed to work on them at home, etc. I've recently tried opening some ppt presentations over email and was not able to doe so. Long story short, I determined that although I have word, excel, access, etc etc, I do NOT have ppt on my computer. I removed and installed the Microsoft disc I have
several times and still NO POWERPOINT. Can someone help me.
>
> I can't afford another $200 disc. THANKS!
>
>
>
> http://www.rdpslides.com/pptfaq/FAQ00280.htm should help you understand
> what is going on, and what your choices are.
>
So if you have either of these:
Office 2000 Developer, Office 2000 Premium, Office 2000 Professional,
Office 2000 Small Business Edition, Office 2000 Standard
you can get Powerpoint 2003 for 109 US$ or 89.26 EUR.
--
Amedee Van Gasse
http://www.amedee.be
Dit bericht is geplaatst in een nieuwsgroep. Post je evt antwoord of
vervolgvraag graag in dezelfde thread in de nieuwsgroep a.u.b.