+ Reply to Thread
Results 1 to 6 of 6

VBA Excel - Power Point

  1. #1
    Diego
    Guest

    VBA Excel - Power Point


    I am creating a tool in Excel to copy data/graph from
    Excel to PowerPoint.

    Dim PPApp As PowerPoint.Application
    Dim PPPres As PowerPoint.Presentation

    Set PPApp = CreateObject("PowerPoint.Application")
    PPApp.Visible = True
    Set PPPres = PPApp.Presentations.Open(ppt_file)
    ....

    At the end of the code, I put:

    ThisWorkbook.Activate
    Msgbox("You have finished running the tool")

    But it seems the screen still focuses in PowerPoint, so I
    have to manually switch to Excel to see the msgbox. How do
    I change the screen to the Excel file instead? Or, is it
    possible to create the msgbox in PowerPoint instead?

    Also, I put Application.ScreenUpdating = False in my code,
    but it seems it onlhy works for Excel?


    Thanks for the help


  2. #2
    ben
    Guest

    RE: VBA Excel - Power Point

    Diego,

    this thisworkbook.activate only works inside excel it does not make the
    excel application activate. try setting your excel application to a variable
    and then activating that

    dim Exapp as excel.application
    set exapp = Excel.application
    'all other code


    exapp.activate

    ben
    "Diego" wrote:

    >
    > I am creating a tool in Excel to copy data/graph from
    > Excel to PowerPoint.
    >
    > Dim PPApp As PowerPoint.Application
    > Dim PPPres As PowerPoint.Presentation
    >
    > Set PPApp = CreateObject("PowerPoint.Application")
    > PPApp.Visible = True
    > Set PPPres = PPApp.Presentations.Open(ppt_file)
    > ....
    >
    > At the end of the code, I put:
    >
    > ThisWorkbook.Activate
    > Msgbox("You have finished running the tool")
    >
    > But it seems the screen still focuses in PowerPoint, so I
    > have to manually switch to Excel to see the msgbox. How do
    > I change the screen to the Excel file instead? Or, is it
    > possible to create the msgbox in PowerPoint instead?
    >
    > Also, I put Application.ScreenUpdating = False in my code,
    > but it seems it onlhy works for Excel?
    >
    >
    > Thanks for the help
    >
    >


  3. #3
    Diego
    Guest

    RE: VBA Excel - Power Point


    Thanks. However, I got an error "Object does not support
    this property/method" in exapp.activate. Do you know why?




    >-----Original Message-----
    >Diego,
    >
    >this thisworkbook.activate only works inside excel it

    does not make the
    >excel application activate. try setting your excel

    application to a variable
    >and then activating that
    >
    >dim Exapp as excel.application
    >set exapp = Excel.application
    >'all other code
    >
    >
    >exapp.activate
    >
    >ben
    >"Diego" wrote:
    >
    >>
    >> I am creating a tool in Excel to copy data/graph from
    >> Excel to PowerPoint.
    >>
    >> Dim PPApp As PowerPoint.Application
    >> Dim PPPres As PowerPoint.Presentation
    >>
    >> Set PPApp = CreateObject("PowerPoint.Application")
    >> PPApp.Visible = True
    >> Set PPPres = PPApp.Presentations.Open(ppt_file)
    >> ....
    >>
    >> At the end of the code, I put:
    >>
    >> ThisWorkbook.Activate
    >> Msgbox("You have finished running the tool")
    >>
    >> But it seems the screen still focuses in PowerPoint, so

    I
    >> have to manually switch to Excel to see the msgbox. How

    do
    >> I change the screen to the Excel file instead? Or, is

    it
    >> possible to create the msgbox in PowerPoint instead?
    >>
    >> Also, I put Application.ScreenUpdating = False in my

    code,
    >> but it seems it onlhy works for Excel?
    >>
    >>
    >> Thanks for the help
    >>
    >>

    >.
    >


  4. #4
    ben
    Guest

    RE: VBA Excel - Power Point

    diego,

    it would appear i did not check the properties available for Excel, and
    activate is not one of them. Try reinstating application.screenupdating =
    true before the switch back to excel, or how about not letting power point
    show at all?

    "Diego" wrote:

    >
    > Thanks. However, I got an error "Object does not support
    > this property/method" in exapp.activate. Do you know why?
    >
    >
    >
    >
    > >-----Original Message-----
    > >Diego,
    > >
    > >this thisworkbook.activate only works inside excel it

    > does not make the
    > >excel application activate. try setting your excel

    > application to a variable
    > >and then activating that
    > >
    > >dim Exapp as excel.application
    > >set exapp = Excel.application
    > >'all other code
    > >
    > >
    > >exapp.activate
    > >
    > >ben
    > >"Diego" wrote:
    > >
    > >>
    > >> I am creating a tool in Excel to copy data/graph from
    > >> Excel to PowerPoint.
    > >>
    > >> Dim PPApp As PowerPoint.Application
    > >> Dim PPPres As PowerPoint.Presentation
    > >>
    > >> Set PPApp = CreateObject("PowerPoint.Application")
    > >> PPApp.Visible = True
    > >> Set PPPres = PPApp.Presentations.Open(ppt_file)
    > >> ....
    > >>
    > >> At the end of the code, I put:
    > >>
    > >> ThisWorkbook.Activate
    > >> Msgbox("You have finished running the tool")
    > >>
    > >> But it seems the screen still focuses in PowerPoint, so

    > I
    > >> have to manually switch to Excel to see the msgbox. How

    > do
    > >> I change the screen to the Excel file instead? Or, is

    > it
    > >> possible to create the msgbox in PowerPoint instead?
    > >>
    > >> Also, I put Application.ScreenUpdating = False in my

    > code,
    > >> but it seems it onlhy works for Excel?
    > >>
    > >>
    > >> Thanks for the help
    > >>
    > >>

    > >.
    > >

    >


  5. #5
    Diego
    Guest

    RE: VBA Excel - Power Point


    It still did not work. I need to show the PowerPoint as
    well.

    >-----Original Message-----
    >diego,
    >
    > it would appear i did not check the properties

    available for Excel, and
    >activate is not one of them. Try reinstating

    application.screenupdating =
    >true before the switch back to excel, or how about not

    letting power point
    >show at all?
    >
    >"Diego" wrote:
    >
    >>
    >> Thanks. However, I got an error "Object does not

    support
    >> this property/method" in exapp.activate. Do you know

    why?
    >>
    >>
    >>
    >>
    >> >-----Original Message-----
    >> >Diego,
    >> >
    >> >this thisworkbook.activate only works inside excel

    it
    >> does not make the
    >> >excel application activate. try setting your excel

    >> application to a variable
    >> >and then activating that
    >> >
    >> >dim Exapp as excel.application
    >> >set exapp = Excel.application
    >> >'all other code
    >> >
    >> >
    >> >exapp.activate
    >> >
    >> >ben
    >> >"Diego" wrote:
    >> >
    >> >>
    >> >> I am creating a tool in Excel to copy data/graph

    from
    >> >> Excel to PowerPoint.
    >> >>
    >> >> Dim PPApp As PowerPoint.Application
    >> >> Dim PPPres As PowerPoint.Presentation
    >> >>
    >> >> Set PPApp = CreateObject("PowerPoint.Application")
    >> >> PPApp.Visible = True
    >> >> Set PPPres = PPApp.Presentations.Open(ppt_file)
    >> >> ....
    >> >>
    >> >> At the end of the code, I put:
    >> >>
    >> >> ThisWorkbook.Activate
    >> >> Msgbox("You have finished running the tool")
    >> >>
    >> >> But it seems the screen still focuses in PowerPoint,

    so
    >> I
    >> >> have to manually switch to Excel to see the msgbox.

    How
    >> do
    >> >> I change the screen to the Excel file instead? Or,

    is
    >> it
    >> >> possible to create the msgbox in PowerPoint instead?
    >> >>
    >> >> Also, I put Application.ScreenUpdating = False in my

    >> code,
    >> >> but it seems it onlhy works for Excel?
    >> >>
    >> >>
    >> >> Thanks for the help
    >> >>
    >> >>
    >> >.
    >> >

    >>

    >.
    >


  6. #6
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Diego , Hello Ben

    you may replace

    ThisWorkbook.Activate
    Msgbox("You have finished running the tool")

    for

    PPApp.WindowState = ppWindowMinimized
    Msgbox("You have finished running the tool")




    Sub insertionGraphiqueDansPowerPoint()
    'activate Microsoft Powerpoint Object Library
    '
    'copy the first graph in the ActiveSheet
    'Past in the first slide of the Présentation
    '
    Dim PPT As PowerPoint.Application
    Dim PptDoc As PowerPoint.Presentation
    Dim NbShpe As Byte

    Set PPT = CreateObject("Powerpoint.Application")
    PPT.Visible = True
    Set PptDoc = PPT.Presentations.Open("C:\maPresentation.ppt")

    ActiveSheet.ChartObjects(1).Copy
    PptDoc.Slides(1).Shapes.Paste

    NbShpe = PptDoc.Slides(1).Shapes.Count

    With PptDoc.Slides(1).Shapes(NbShpe)
    .Name = "monGraph" & NbShpe
    .Left = 100
    .Top = 200
    .Height = 400
    .Width = 500
    End With

    PPT.WindowState = ppWindowMinimized
    MsgBox "Finished"
    'PptDoc.Save
    'PptDoc.Close
    'PPT.Quit
    End Sub



    Regards ,
    michel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1