Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. PowerPoint Application

PowerPoint Application

Scheduled Pinned Locked Moved Visual Basic
questionhelp
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rdop
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • R rdop

      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

      D Offline
      D Offline
      ddecoy
      wrote on last edited by
      #2

      take a look here unable-to-suppress-ppt-window

      R 1 Reply Last reply
      0
      • D ddecoy

        take a look here unable-to-suppress-ppt-window

        R Offline
        R Offline
        rdop
        wrote on last edited by
        #3

        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

        J 1 Reply Last reply
        0
        • R rdop

          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

          J Offline
          J Offline
          JR212
          wrote on last edited by
          #4

          what do you think of this

          Const SW_HIDE = 0
          Const SW_SHOWNORMAL = 1
          Const SW_SHOWMINIMIZED = 2
          Const SW_SHOWMAXIMIZED = 3

          Private 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 = 1002

          Declare 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 Sub

          Function 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

          L M 2 Replies Last reply
          0
          • J JR212

            what do you think of this

            Const SW_HIDE = 0
            Const SW_SHOWNORMAL = 1
            Const SW_SHOWMINIMIZED = 2
            Const SW_SHOWMAXIMIZED = 3

            Private 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 = 1002

            Declare 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 Sub

            Function 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

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            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 FALSE

            Set pShow = Prese

            J 1 Reply Last reply
            0
            • J JR212

              what do you think of this

              Const SW_HIDE = 0
              Const SW_SHOWNORMAL = 1
              Const SW_SHOWMINIMIZED = 2
              Const SW_SHOWMAXIMIZED = 3

              Private 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 = 1002

              Declare 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 Sub

              Function 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

              M Offline
              M Offline
              MsmVc
              wrote on last edited by
              #6

              It's Nice example. But it's show error nHandle not define

              modified on Friday, June 18, 2010 8:55 AM

              L J 2 Replies Last reply
              0
              • M MsmVc

                It's Nice example. But it's show error nHandle not define

                modified on Friday, June 18, 2010 8:55 AM

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                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![^]

                M 1 Reply Last reply
                0
                • L Lost User

                  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![^]

                  M Offline
                  M Offline
                  MsmVc
                  wrote on last edited by
                  #8

                  I got again error

                  429 ActiveX component cann't create object

                  Please help me

                  modified on Friday, June 18, 2010 8:56 AM

                  1 Reply Last reply
                  0
                  • L Lost User

                    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 FALSE

                    Set pShow = Prese

                    J Offline
                    J Offline
                    JR212
                    wrote on last edited by
                    #9

                    I'm very sorry but I haven't read the remarques completly. It was my wrong thinking that it was already in the remarques. I read more carfully in the future. However al that other code came also from internet.

                    1 Reply Last reply
                    0
                    • M MsmVc

                      It's Nice example. But it's show error nHandle not define

                      modified on Friday, June 18, 2010 8:55 AM

                      J Offline
                      J Offline
                      JR212
                      wrote on last edited by
                      #10

                      in the declaration of handle its crearly tells function as long. So (almost) use the same datatype as the function

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups