PowerPoint Application
-
Hi All How can set visible properties false of PowerPoint? I am useing vb 6.0.
Dim pPT As PowerPoint.Application
Dim pPTopen As PowerPoint.Presentation
Dim PptName As String
PptName = "c:\nice.ppt"
Set pPT = New PowerPoint.Application
pPT.Visible = True
Set pPTopen = pPT.Presentations.Open(PptName)How can i use pPT.Visible = False When i use pPT.Visible = False then i got error.Error is here
Run-time error '-2147188160(80048240)'
Application (Unknown mwmber) : Invalied request.Hiding the application window is not allowed.Thanks in advance
-
Hi All How can set visible properties false of PowerPoint? I am useing vb 6.0.
Dim pPT As PowerPoint.Application
Dim pPTopen As PowerPoint.Presentation
Dim PptName As String
PptName = "c:\nice.ppt"
Set pPT = New PowerPoint.Application
pPT.Visible = True
Set pPTopen = pPT.Presentations.Open(PptName)How can i use pPT.Visible = False When i use pPT.Visible = False then i got error.Error is here
Run-time error '-2147188160(80048240)'
Application (Unknown mwmber) : Invalied request.Hiding the application window is not allowed.Thanks in advance
take a look here unable-to-suppress-ppt-window
-
take a look here unable-to-suppress-ppt-window
-
Thanks foe reply But there is no +ve output.I need visible=False or hide powerpoint application. There is no any option to hide or flas powerpoint application. Please he me
what do you think of this
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const ERR_NO_WINDOW_HANDLE As Long = 1000
Const ERR_WINDOW_LOCK_FAIL As Long = 1001
Const ERR_VERSION_NOT_SUPPORTED As Long = 1002Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) As Long
Sub sOpenPowerpoint()
Dim pPT As PowerPoint.Application
Dim pPTopen As PowerPoint.Presentation
Dim PptName As String
PptName = "C:\A\Nice.pptx"
Set pPT = CreateObject("PowerPoint.Application")
pPT.Visible = True
Set pPTopen = pPT.Presentations.Open(PptName)
nHandle = fHandle
ShowWindow nHandle, SW_HIDE
End SubFunction fHandle() As Long
Static hwnd As Long
Dim VersionNo As String' Get Version Number
VersionNo = Left(Application.Version, InStr(1, Application.Version, ".") - 1)
' Get handle to the main application window using ClassName
Select Case VersionNo Case "8" ' For PPT97: hwnd = FindWindow("PP97FrameClass", 0&) Case "9" ' For PPT2K: hwnd = FindWindow("PP9FrameClass", 0&) Case "10" ' For XP: hwnd = FindWindow("PP10FrameClass", 0&) Case "11" ' For 2003: hwnd = FindWindow("PP11FrameClass", 0&) Case "12" ' For 2007: hwnd = FindWindow("PP12FrameClass", 0&) Case Else Err.Raise Number:=vbObjectError + ERR\_VERSION\_NOT\_SUPPORTED, \_ Description:="Supported for PowerPoint 97/2000/2002/2003 only." Exit Function End Select If hwnd = 0 Then Err.Raise Number:=vbObjectError + ERR\_NO\_WINDOW\_HANDLE, \_ Description:="Unable to get the PowerPoint Window handle" Exit Function End If If LockWindowUpdate(hwnd) = 0 Then Err.Raise Number:=vbObjectError + ERR\_WINDOW\_LOCK\_FAIL, \_ Description:="Unable to set a PowerPoint window lock" Exit Function End If
fHandle = hwnd
End Function
-
what do you think of this
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const ERR_NO_WINDOW_HANDLE As Long = 1000
Const ERR_WINDOW_LOCK_FAIL As Long = 1001
Const ERR_VERSION_NOT_SUPPORTED As Long = 1002Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) As Long
Sub sOpenPowerpoint()
Dim pPT As PowerPoint.Application
Dim pPTopen As PowerPoint.Presentation
Dim PptName As String
PptName = "C:\A\Nice.pptx"
Set pPT = CreateObject("PowerPoint.Application")
pPT.Visible = True
Set pPTopen = pPT.Presentations.Open(PptName)
nHandle = fHandle
ShowWindow nHandle, SW_HIDE
End SubFunction fHandle() As Long
Static hwnd As Long
Dim VersionNo As String' Get Version Number
VersionNo = Left(Application.Version, InStr(1, Application.Version, ".") - 1)
' Get handle to the main application window using ClassName
Select Case VersionNo Case "8" ' For PPT97: hwnd = FindWindow("PP97FrameClass", 0&) Case "9" ' For PPT2K: hwnd = FindWindow("PP9FrameClass", 0&) Case "10" ' For XP: hwnd = FindWindow("PP10FrameClass", 0&) Case "11" ' For 2003: hwnd = FindWindow("PP11FrameClass", 0&) Case "12" ' For 2007: hwnd = FindWindow("PP12FrameClass", 0&) Case Else Err.Raise Number:=vbObjectError + ERR\_VERSION\_NOT\_SUPPORTED, \_ Description:="Supported for PowerPoint 97/2000/2002/2003 only." Exit Function End Select If hwnd = 0 Then Err.Raise Number:=vbObjectError + ERR\_NO\_WINDOW\_HANDLE, \_ Description:="Unable to get the PowerPoint Window handle" Exit Function End If If LockWindowUpdate(hwnd) = 0 Then Err.Raise Number:=vbObjectError + ERR\_WINDOW\_LOCK\_FAIL, \_ Description:="Unable to set a PowerPoint window lock" Exit Function End If
fHandle = hwnd
End Function
I guess you missed the copyright on that code snippet...
' --------------------------------------------------------------------------------
' Copyright ©1999-2009, Shyam Pillai, All Rights Reserved.
' --------------------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
' --------------------------------------------------------------------------------I don't mind you copy / pasting it really, but it fucking pisses me off that you don't at least give credit to the original link. (Here, by the way.[^]) and you could have posted the second entry on that page as well... How to open a PowerPoint Show (*.pps) file thru code It's fairly simple to open a PowerPoint file (*.ppt) for editing using VBA code however opening a PowerPoint Show (*.pps) file for editing is altogether another matter. Use the Presentation.Open method and it defaults to open the file in Slide Show mode. This might not be desirable. The routine below illustrates a manner of woring around the default behaviour and opening the file for editing. The routine also illustrates the use of the ScreenUpdating property (code listed above).
' --------------------------------------------------------------------------------
' Copyright ©1999-2009, Shyam Pillai, All Rights Reserved.
' --------------------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
' --------------------------------------------------------------------------------
Sub OpenPPSForEdit()On Error GoTo ErrHandle
Dim pShow As Presentation
' Lock the window to prevent refreshing
' See above article example for the code
ScreenUpdating = False
'Open the show, however use additional flag - WithWindow set to FALSESet pShow = Prese
-
what do you think of this
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const ERR_NO_WINDOW_HANDLE As Long = 1000
Const ERR_WINDOW_LOCK_FAIL As Long = 1001
Const ERR_VERSION_NOT_SUPPORTED As Long = 1002Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) As Long
Sub sOpenPowerpoint()
Dim pPT As PowerPoint.Application
Dim pPTopen As PowerPoint.Presentation
Dim PptName As String
PptName = "C:\A\Nice.pptx"
Set pPT = CreateObject("PowerPoint.Application")
pPT.Visible = True
Set pPTopen = pPT.Presentations.Open(PptName)
nHandle = fHandle
ShowWindow nHandle, SW_HIDE
End SubFunction fHandle() As Long
Static hwnd As Long
Dim VersionNo As String' Get Version Number
VersionNo = Left(Application.Version, InStr(1, Application.Version, ".") - 1)
' Get handle to the main application window using ClassName
Select Case VersionNo Case "8" ' For PPT97: hwnd = FindWindow("PP97FrameClass", 0&) Case "9" ' For PPT2K: hwnd = FindWindow("PP9FrameClass", 0&) Case "10" ' For XP: hwnd = FindWindow("PP10FrameClass", 0&) Case "11" ' For 2003: hwnd = FindWindow("PP11FrameClass", 0&) Case "12" ' For 2007: hwnd = FindWindow("PP12FrameClass", 0&) Case Else Err.Raise Number:=vbObjectError + ERR\_VERSION\_NOT\_SUPPORTED, \_ Description:="Supported for PowerPoint 97/2000/2002/2003 only." Exit Function End Select If hwnd = 0 Then Err.Raise Number:=vbObjectError + ERR\_NO\_WINDOW\_HANDLE, \_ Description:="Unable to get the PowerPoint Window handle" Exit Function End If If LockWindowUpdate(hwnd) = 0 Then Err.Raise Number:=vbObjectError + ERR\_WINDOW\_LOCK\_FAIL, \_ Description:="Unable to set a PowerPoint window lock" Exit Function End If
fHandle = hwnd
End Function
-
It's Nice example. But it's show error nHandle not define
modified on Friday, June 18, 2010 8:55 AM
View my reply, go to the original page for the entire snippet of code. (That would be here.[^]
Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]
-
View my reply, go to the original page for the entire snippet of code. (That would be here.[^]
Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]
-
I guess you missed the copyright on that code snippet...
' --------------------------------------------------------------------------------
' Copyright ©1999-2009, Shyam Pillai, All Rights Reserved.
' --------------------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
' --------------------------------------------------------------------------------I don't mind you copy / pasting it really, but it fucking pisses me off that you don't at least give credit to the original link. (Here, by the way.[^]) and you could have posted the second entry on that page as well... How to open a PowerPoint Show (*.pps) file thru code It's fairly simple to open a PowerPoint file (*.ppt) for editing using VBA code however opening a PowerPoint Show (*.pps) file for editing is altogether another matter. Use the Presentation.Open method and it defaults to open the file in Slide Show mode. This might not be desirable. The routine below illustrates a manner of woring around the default behaviour and opening the file for editing. The routine also illustrates the use of the ScreenUpdating property (code listed above).
' --------------------------------------------------------------------------------
' Copyright ©1999-2009, Shyam Pillai, All Rights Reserved.
' --------------------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
' --------------------------------------------------------------------------------
Sub OpenPPSForEdit()On Error GoTo ErrHandle
Dim pShow As Presentation
' Lock the window to prevent refreshing
' See above article example for the code
ScreenUpdating = False
'Open the show, however use additional flag - WithWindow set to FALSESet pShow = Prese
-
It's Nice example. But it's show error nHandle not define
modified on Friday, June 18, 2010 8:55 AM