![]() |
|
#1
|
|||
|
|||
![]()
If the notes are just plain text (no formatting) then you can adapt the code for pictures.
The notes are normally in Shapes(2) of the notes page. If for some reason theya re not it may crash. Sub switchNotes() Dim oTarget As Presentation Dim oSource As Presentation Dim i As Integer On Error Resume Next 'NOTE use the names of your own presentations Set oTarget = Presentations("Image1.pptx") Set oSource = Presentations("Image2.pptx") For i = 1 To oSource.Slides.Count oTarget.Slides(i).NotesPage.Shapes(2) _ .TextFrame.TextRange = _ oSource.Slides(i).NotesPage.Shapes(2) _ .TextFrame.TextRange Next i End Sub |
#2
|
|||
|
|||
![]()
This worked perfectly! Thanks!
|
#3
|
|||
|
|||
![]()
Hi (several years later) - this code worked perfectly for me as well, but is it possible to modify the code to keep the source formatting of the presentation notes when moving over to the new presentation? I tried the following code, but it doesn't work very well (doesn't keep the font sizes after slide 1, completely breaks after slide 8). Is there a better way to do this?
Sub switchNotes() Dim oTarget As Presentation Dim oSource As Presentation Dim i As Integer On Error Resume Next Set oTarget = Presentations("TEST2.pptx") Set oSource = Presentations("TEST1.pptx") For i = 1 To oSource.Slides.Count oSource.Slides(i).NotesPage.Shapes(2) _ .TextFrame.TextRange.Copy oTarget.Slides(i).NotesPage.Shapes(2) _ .TextFrame.TextRange.PasteSpecial (ppPasteRTF) Next i End Sub Thanks! |
#4
|
|||
|
|||
![]()
Hey Alex311, it looks like the only issue was using TextRange.PasteSpecial (ppPasteRTF)... I used the regular paste and it worked like a charm.
Here's my updated version (tested and working flawlessly) Sub switchNotes() Dim oTarget As Presentation Dim oSource As Presentation Dim i As Integer On Error Resume Next Set oTarget = Presentations("target.pptx") Set oSource = Presentations("source.pptx") For i = 1 To oSource.Slides.Count oSource.Slides(i).NotesPage.Shapes(2) _ .TextFrame.TextRange.Copy oTarget.Slides(i).NotesPage.Shapes(2) _ .TextFrame.TextRange.Paste Next i End Sub Hoping it can help you and others as well. |
#5
|
|||
|
|||
![]()
Hi all.
After using this a little, I've made a few adjustments. - Added a few comments in the start of the script to tell clearly how to use it. - Commented out the 'On Error Resume Next', as it might hide a failure (I'd rather know when this is not working and debug WHY or WHERE it's not working). - Added (commented out) a MsgBox indicating the slide # so you can tell where something failed (use only if debugging). - Added an additional verification forcing a custom error in case the source and target presentations' slide count do not match. If for a reason you know those will not match, you may need to comment it out. Code:
Sub switchNotes() ' Target and Source files should be open ' oSource and oTarget should be filled with filename (no path) ' use with 'call switchNotes()' ' 'On Error Resume Next' commented out to spot failed process ' MsgBox used for debug purposes when needed Dim oTarget As Presentation Dim oSource As Presentation Dim i As Integer 'On Error Resume Next Set oSource = Presentations("mySource.pptx") Set oTarget = Presentations("myTarget.pptx") If oSource.Slides.Count <> oTarget.Slides.Count Then Err.Raise -10000000 For i = 1 To oSource.Slides.Count 'MsgBox ("diapo " & i) oSource.Slides(i).NotesPage.Shapes(2).TextFrame.TextRange.Copy oTarget.Slides(i).NotesPage.Shapes(2).TextFrame.TextRange.Paste Next i End Sub Hope it helps ![]() |
#6
|
|||
|
|||
![]() Quote:
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PowerPoint Macro - Copy and Replace pictures from one PPT to another PPT | mrayncrental | PowerPoint | 2 | 06-09-2014 02:52 AM |
Macro to copy formula from one cell to another | anwar | Excel Programming | 1 | 04-25-2014 08:27 PM |
![]() |
adisl | Word VBA | 4 | 03-25-2014 02:40 AM |
![]() |
jpol | Excel Programming | 1 | 03-01-2013 05:53 AM |
Powerpoint copy notes | no1_titch | PowerPoint | 0 | 09-07-2010 06:16 AM |