mahmed1
Well-known Member
- Joined
- Mar 28, 2009
- Messages
- 2,302
- Office Version
- 365
- 2016
- Platform
- Windows
Hi ZVI,
I have created another thread as advised
To recap - I need to copy my ranges as picture or best quality and paste it into my PP Templat Pres
I have a PP Template which contains 2 sheets (Title sheet with a text box named TitleText) and Content Slide with a textbox named ContentText
I found some code online that does some of this but this creates a new powerpoint presentation and pastes it there. My condition is slightly diff where I need to 1st update the Titke slide text and then use the Content slide template to paste each slide in as the text and theme is pre-formatted
I then need to resize my image so it looks nice and not overlapping the slide
This is the code I found - I tried to add my bits of code attempt in there and have commented bits where I would need to change to suit me (I have left the original code that I found in there for ref)
Hopefully this will make more sense
This is the code
I have created another thread as advised
To recap - I need to copy my ranges as picture or best quality and paste it into my PP Templat Pres
I have a PP Template which contains 2 sheets (Title sheet with a text box named TitleText) and Content Slide with a textbox named ContentText
I found some code online that does some of this but this creates a new powerpoint presentation and pastes it there. My condition is slightly diff where I need to 1st update the Titke slide text and then use the Content slide template to paste each slide in as the text and theme is pre-formatted
I then need to resize my image so it looks nice and not overlapping the slide
This is the code I found - I tried to add my bits of code attempt in there and have commented bits where I would need to change to suit me (I have left the original code that I found in there for ref)
Hopefully this will make more sense
This is the code
Code:
Sub CreatePowerPointPresentation()
Dim DasboardSh As Worksheet
Dim Weekdash As Worksheet
Dim CalcSh As Worksheet
Dim MyTitle As Range
Dim PPTitleTextRange As Range
Dim PPCopyRange As Range
Dim PowerPointApp As Object
Dim PPTemmplatePath As String
Dim TitleTextRow As Long
Dim CopyPictureRow As Long
Set DasboardSh = Worksheets("DAILY SUMMARY")
Set Weekdash = Worksheets("WEEK DASHBOARD")
Set CalcSh = Worksheets("CALCULATION")
Set MyTitle = CalcSh.Range("TITLETEXT")
Set PPTitleTextRange = CalcSh.Range("PPTITLE")
'Set PPCopyRange = CalcSh.Range("COPYRANGE")
'Create an Instance of PowerPoint
On Error Resume Next
'Is PowerPoint Template already opened?
'This is where i need to open up my PP Template but is its open then set a ref to it
'Set PowerPointApp = GetObject("PowerPoint.Application")
'Clear the error between errors
Err.Clear
'If PowerPoint is not already open then open PowerPoint
'This is where i need to open up my PP Template but is its open then set a ref to it
'If PowerPointApp Is Nothing Then Set PowerPointApp = CreateObject("PowerPoint.Application")
'Handle if the PowerPoint Application is not found
If Err.Number = 429 Then
MsgBox "PowerPoint could not be found, aborting."
Exit Sub
End If
On Error GoTo 0
'Make PowerPoint Template Visible and Active
'PowerPointApp.Visible = True
'PowerPointApp.Activate
'Create a New Presentation
'Set myPresentation = PowerPointApp.Presentations.Add
'Create a copy of Slide 1 (Title Slide) to the end of the slide - i have renamed the text box to TitleText
'Set mySlide = myPresentation.Slides.Add(1, 11) '11 = ppLayoutTitleOnly
'Add the MyTitle.value to TitleText
'CopyRanges
For i = 2 To 11
'SlideTitle = CalcSh.Range("U" & i)
'Create copy of Content Slide (Slide) - i have named the text box ContextText
'Add the text SlideTitle to ContextText
'Set PPCopyRange = Weekdash.Range("V" & i)
'Copy Excel Range
'PPCopyRange.Copy
'I need to Paste to this content slide and resize and position
'Set mySlide = myPresentation.Slides.Add(1, 11) '11 = ppLayoutTitleOnly
'Set myShapeRange = mySlide.Shapes(mySlide.Shapes.Count)
'mySlide.Shapes.PasteSpecial DataType:=2
Next i
End Sub