Sub ChartToPresentation()
'Dimension the var's
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim msgPrompt As String
Dim strPathName As String
Dim vAnswer As Variant
'the word in between file vars
Dim wrdDoc As Object
Dim wrdApp As Object
'**************STEP ONE: COLLECT PATHNAME****************
'Give the prompt its first value value
msgPrompt = "You are about to export summary to Power Point."
MsgBox msgPrompt, vbInformation, "Are you ready?"
'Start the input box to get the value
'!!!!! This is not being used right now !!!!!!!!!
msgPrompt = "Please enter the full drive-path for the Power Point Presentation"
vAnswer = Application.InputBox(msgPrompt, "Pathname?", Type:=2)
If vAnswer = "" Then
msgPrompt = "You have failed to enter a drive path."
msgPrompt = msgPrompt + vbCrLf
msgPrompt = msgPrompt + "Please Try Again."
MsgBox msgPrompt, vbCritical, "No Drive-Path!"
Else
strPathName = vAnswer
End If
'*************STEP TWO: BEGIN EXECUTE *********************
'+++++++++++CHART ONE +++++++++++++++
'grabs the first chart for pasting
Sheet4.ChartObjects("Chart 2").Activate
ActiveChart.ChartArea.Select
ActiveChart.CopyPicture xlScreen, xlPicture, xlScreen
ActiveWindow.Visible = False
' Reference existing instance of PowerPoint 2000
Set PPApp = GetObject(, "Powerpoint.Application.9")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
'This will paste the first chart into place
PPApp.ActiveWindow.ViewType = ppViewOutline
PPApp.ActivePresentation.Slides(3).Select
PPApp.ActiveWindow.ViewType = ppViewSlide
PPApp.ActiveWindow.View.Paste
With PPApp.ActiveWindow.Selection.ShapeRange
.Height = 170
.Top = 100
.Left = 330
End With
'+++++++++++CHART TWO+++++++++++++++
'grabs the Second chart for pasting
Sheet4.ChartObjects("Chart 7").Activate
ActiveChart.ChartArea.Select
ActiveChart.CopyPicture xlScreen, xlPicture, xlScreen
ActiveWindow.Visible = False
' Reference existing instance of PowerPoint 2000
Set PPApp = GetObject(, "Powerpoint.Application.9")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
'This will paste the first chart into place
PPApp.ActiveWindow.ViewType = ppViewOutline
PPApp.ActivePresentation.Slides(3).Select
PPApp.ActiveWindow.ViewType = ppViewSlide
PPApp.ActiveWindow.View.Paste
With PPApp.ActiveWindow.Selection.ShapeRange
.Height = 190
.Top = 270
.Left = 330
End With
'+++++++++++CHART THREE+++++++++++++++
'grabs the third chart for pasting
Sheet4.ChartObjects("Chart 6").Activate
ActiveChart.ChartArea.Select
ActiveChart.CopyPicture xlScreen, xlPicture, xlScreen
ActiveWindow.Visible = False
' Reference existing instance of PowerPoint 2000
Set PPApp = GetObject(, "Powerpoint.Application.9")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
'This will paste the first chart into place
PPApp.ActiveWindow.ViewType = ppViewOutline
PPApp.ActivePresentation.Slides(3).Select
PPApp.ActiveWindow.ViewType = ppViewSlide
PPApp.ActiveWindow.View.Paste
With PPApp.ActiveWindow.Selection.ShapeRange
.Height = 190
.Top = 270
.Left = 509
End With
'<====== HERE IS WHERE THE PROBLEM STARTS ======>
'+++++++++++Graph ONE+++++++++++++++
'grabs the executive summary
Sheet4.Range("A4:c19").Activate
Sheet4.Range("A4:c19").CopyPicture xlScreen, xlBitmap
ActiveWindow.Visible = False
'the word inbetween
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.documents.Add()
' Pastes the information on the Clipboard into the Word document as
' an Enhanced Metafile.
With wrdApp.ActiveWindow.Selection
.Paste
.Select
.Copy ' Copy the MetaFile back to the clipboard
End With
Word.ActiveWindow.Selection.s
'This will paste the first chart into place
PPApp.ActiveWindow.ViewType = ppViewOutline
PPApp.ActivePresentation.Slides(3).Select
PPApp.ActiveWindow.ViewType = ppViewSlide
PPApp.ActiveWindow.View.Paste
With PPApp.ActiveWindow.Selection.ShapeRange
.Height = 250
.Top = 100
.Left = 30
End With
' Close the document without saving changes.
wrdDoc.Close (wdDoNotSaveChanges)
wrdApp.Quit
' Clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
Set wrdApp = Nothing
Set wrdDoc = Nothing