Activate Excel Workbook Over PPT

MehmetYıldız

New Member
Joined
Dec 19, 2012
Messages
20
Hi Everyone,

I am using MS 2010 and i have a question about activate the excel workbook over powerpoint?

I opened and closed a ppt file but a blank ppt screen still on. I cannot activate the excel over ppt.

I have to show the frm1 on screen because it has confirmation message.

Could you please help? By the way, i searched at forum but i cannot find any answer :(

My code is like below,


Sub PasteChart()


Application.DisplayAlerts = False
Application.ScreenUpdating = False


On Error GoTo Errp:


Dim ppApp As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide
Dim oSld As PowerPoint.Slide
Dim oSh As PowerPoint.Shape


Set ppApp = New PowerPoint.Application
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutBlank)


mehmet = Excel.ActiveWorkbook.Name


ppSlide.Select
ActiveChart.ChartArea.Copy


On Error Resume Next


ppSlide.Shapes.PasteSpecial(ppPasteShape, msoFalse, , , , msoFalse).Select


For Each oSld In ppApp.ActivePresentation.Slides
For Each oSh In oSld.Shapes
oSh.LinkFormat.BreakLink
Next
Next


ppSlide.Shapes(1).Copy
ppApp.ActivePresentation.Close


Application.DisplayAlerts = True
Application.ScreenUpdating = True


Workbooks(mehmet).Activate 'Cannot activate the excel. Still PPT blank screen on


With frm1
.Top = Int(((Application.Height / 2) + Application.Top) - (.Height / 2))
.Left = Int(((Application.Width / 2) + Application.Left) - (.Width / 2))
.Show
End With


Set ppApp = Nothing


Exit Sub


Errp:


ppApp.ActivePresentation.Close


Set ppApp = Nothing


Application.DisplayAlerts = True
Application.ScreenUpdating = True


m1 = MsgBox("No Chart Selected. Please Select a Chart to Proceed", vbExclamation, "Dear " & Environ("UserName"))


End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi
I ran your code from Excel and it worked. Anyway, try this:

Code:
Sub PasteChart()


Application.DisplayAlerts = False
Application.ScreenUpdating = False


On Error GoTo Errp:


Dim ppApp As PowerPoint.Application, ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide, oSld As PowerPoint.Slide
Dim oSh As PowerPoint.Shape, mehmet$, m1


Set ppApp = New PowerPoint.Application
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutBlank)


mehmet = Excel.ActiveWorkbook.Name
ppSlide.Select
ActiveChart.ChartArea.Copy


'On Error Resume Next


ppSlide.Shapes.PasteSpecial(ppPasteShape, msoFalse, , , , msoFalse).Select


For Each oSld In ppApp.ActivePresentation.Slides
    For Each oSh In oSld.Shapes
        oSh.LinkFormat.BreakLink
    Next
Next


ppSlide.Shapes(1).Copy
'ppApp.ActivePresentation.Close


Application.DisplayAlerts = True
Application.ScreenUpdating = True


'Workbooks(mehmet).Activate 'Cannot activate the excel. Still PPT blank screen on
AppActivate "Microsoft Excel"
With frm1
    .Top = Int(((Application.Height / 2) + Application.Top) - (.Height / 2))
    .Left = Int(((Application.Width / 2) + Application.Left) - (.Width / 2))
    .Show
End With
Set ppApp = Nothing


Exit Sub


Errp:
ppApp.ActivePresentation.Close


Set ppApp = Nothing
Application.DisplayAlerts = True
Application.ScreenUpdating = True


m1 = MsgBox("No Chart Selected. Please Select a Chart to Proceed", vbExclamation, "Dear " & Environ("UserName"))


End Sub
 
Upvote 0
Hi Worf,

Thank you for your answer an interest but when i ran this line

AppActivate "Microsoft Excel"

Excel crashes. I am using excel 2010 by the way

Hi
I ran your code from Excel and it worked. Anyway, try this:

Code:
Sub PasteChart()


Application.DisplayAlerts = False
Application.ScreenUpdating = False


On Error GoTo Errp:


Dim ppApp As PowerPoint.Application, ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide, oSld As PowerPoint.Slide
Dim oSh As PowerPoint.Shape, mehmet$, m1


Set ppApp = New PowerPoint.Application
Set ppPres = ppApp.Presentations.Add
Set ppSlide = ppPres.Slides.Add(1, ppLayoutBlank)


mehmet = Excel.ActiveWorkbook.Name
ppSlide.Select
ActiveChart.ChartArea.Copy


'On Error Resume Next


ppSlide.Shapes.PasteSpecial(ppPasteShape, msoFalse, , , , msoFalse).Select


For Each oSld In ppApp.ActivePresentation.Slides
    For Each oSh In oSld.Shapes
        oSh.LinkFormat.BreakLink
    Next
Next


ppSlide.Shapes(1).Copy
'ppApp.ActivePresentation.Close


Application.DisplayAlerts = True
Application.ScreenUpdating = True


'Workbooks(mehmet).Activate 'Cannot activate the excel. Still PPT blank screen on
AppActivate "Microsoft Excel"
With frm1
    .Top = Int(((Application.Height / 2) + Application.Top) - (.Height / 2))
    .Left = Int(((Application.Width / 2) + Application.Left) - (.Width / 2))
    .Show
End With
Set ppApp = Nothing


Exit Sub


Errp:
ppApp.ActivePresentation.Close


Set ppApp = Nothing
Application.DisplayAlerts = True
Application.ScreenUpdating = True


m1 = MsgBox("No Chart Selected. Please Select a Chart to Proceed", vbExclamation, "Dear " & Environ("UserName"))


End Sub
 
Upvote 0
Can you test the workbook on another computer, preferably with a different Office version?

Can you upload your actual workbook to a hosting site like Dropbox and paste the link here, so that I can test it with Excel 07?
 
Upvote 0
Can you test the workbook on another computer, preferably with a different Office version?

Can you upload your actual workbook to a hosting site like Dropbox and paste the link here, so that I can test it with Excel 07?

I worked for Samsung and all the excel files have been encrypted due to the security settings.

Sorry for that :(
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,484
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top