Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2014, 04:15 AM
mrayncrental mrayncrental is offline Need Macro to Copy Notes from one PPT to another Windows 7 64bit Need Macro to Copy Notes from one PPT to another Office 2007
Novice
Need Macro to Copy Notes from one PPT to another
 
Join Date: Feb 2014
Posts: 15
mrayncrental is on a distinguished road
Default Need Macro to Copy Notes from one PPT to another

I need a macro to copy the notes from one PowerPoint to another PowerPoint.



The notes contain multiple paragraphs.

Is there an easy way to do this?

Thanks!
Reply With Quote
  #2  
Old 06-09-2014, 06:07 AM
JohnWilson JohnWilson is offline Need Macro to Copy Notes from one PPT to another Windows 7 64bit Need Macro to Copy Notes from one PPT to another Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

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
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 10-08-2014, 02:13 PM
mrayncrental mrayncrental is offline Need Macro to Copy Notes from one PPT to another Windows 7 64bit Need Macro to Copy Notes from one PPT to another Office 2007
Novice
Need Macro to Copy Notes from one PPT to another
 
Join Date: Feb 2014
Posts: 15
mrayncrental is on a distinguished road
Wink Worked -- Many thanks!

This worked perfectly! Thanks!
Reply With Quote
  #4  
Old 09-21-2021, 12:22 PM
alex311 alex311 is offline Need Macro to Copy Notes from one PPT to another Windows XP Need Macro to Copy Notes from one PPT to another Office 2019
Novice
 
Join Date: Sep 2021
Posts: 2
alex311 is on a distinguished road
Default

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!
Reply With Quote
  #5  
Old 04-06-2023, 02:33 PM
Dan_nn Dan_nn is offline Need Macro to Copy Notes from one PPT to another Windows 10 Need Macro to Copy Notes from one PPT to another Office 2021
Novice
 
Join Date: Apr 2023
Posts: 7
Dan_nn is on a distinguished road
Default

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.
Reply With Quote
  #6  
Old 04-10-2023, 08:58 AM
Dan_nn Dan_nn is offline Need Macro to Copy Notes from one PPT to another Windows 10 Need Macro to Copy Notes from one PPT to another Office 2021
Novice
 
Join Date: Apr 2023
Posts: 7
Dan_nn is on a distinguished road
Default Improving the script

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
Finally, as a suggestion, I added this code to an empty presentation (needed to create a module for it) and call it from the immediate window, after I opened the other files and updated the source and target filenames). This way I keep my PPTX files clean and don't need to make them macro-enabled.

Hope it helps
Reply With Quote
  #7  
Old 09-25-2023, 03:32 AM
Vagodspeed Vagodspeed is offline Need Macro to Copy Notes from one PPT to another Windows 11 Need Macro to Copy Notes from one PPT to another Office 2019
Novice
 
Join Date: Sep 2023
Posts: 4
Vagodspeed is on a distinguished road
Default

Hello, newbie here, I was wondering how i can use the above script in PowerPoint?
Reply With Quote
  #8  
Old 09-25-2023, 04:14 AM
Dan_nn Dan_nn is offline Need Macro to Copy Notes from one PPT to another Windows 10 Need Macro to Copy Notes from one PPT to another Office 2021
Novice
 
Join Date: Apr 2023
Posts: 7
Dan_nn is on a distinguished road
Default

Hi Vagodspeed.

If you want to use this script, you should be a bit familiar with using VBA scripts and the scripting interface in Office. If you are not familiar with it, there's more chance of breaking things

The latest version of the script as I posted it is meant to be added as a module in a macro-enabled PPTM file. Then, additionally you need to open the 2 files where you have the source notes to be copied and the target presentation where the notes are meant to be copied to.

You have to update these lines in the code with the actual filenames:
Set oSource = Presentations("mySource.pptx")
Set oTarget = Presentations("myTarget.pptx")

Once all is open and code updated, you need to go to the scripting interface and call the script from the immediate window as I explain in the comments using 'call switchNotes()' (without the quotes).

Good luck
Reply With Quote
  #9  
Old 09-25-2023, 05:00 AM
Vagodspeed Vagodspeed is offline Need Macro to Copy Notes from one PPT to another Windows 11 Need Macro to Copy Notes from one PPT to another Office 2019
Novice
 
Join Date: Sep 2023
Posts: 4
Vagodspeed is on a distinguished road
Default

Thank you for the swift reply!

I will need to read more about VBA scripting then, before trying anything else.
Do you happen to have any recommendations for any resources for doing so?
Reply With Quote
  #10  
Old 09-25-2023, 07:42 AM
Dan_nn Dan_nn is offline Need Macro to Copy Notes from one PPT to another Windows 10 Need Macro to Copy Notes from one PPT to another Office 2021
Novice
 
Join Date: Apr 2023
Posts: 7
Dan_nn is on a distinguished road
Default

it's been really long since I started with this, and I was coming from already knowing different programming languages.

I'd suggest googling for 'VBA tutorial' and quickly check a few to see which one suits better your existing knowledge. Microsoft has it's own documentation but it might be a bit too Microsofty ��

You can look for generals on VB in W3Schools and there's the VBA for dummies (VBA For Dummies, 5th Edition | Wiley) from Wiley... all the 'for Dummies' books are great for starting with anything.

Don't look for Powerpoint specific scripting, because you don't really do much scripting in Powerpoint in general... you'll find a lot more about VBA for Excel and Access, plus some for Word... You only need to understand the basics (structures, variables, conditionals) and object oriented programming basics (such as object, properties, methods). In the end, you are not going to do this from scratch, just make sure you understand the piece of code you have in front and that you can edit it to fir your needs.

Even in the totally worst case, the code already works... if you make backup copies, you can use trial and error and see how it goes
Reply With Quote
  #11  
Old 09-25-2023, 08:29 AM
Vagodspeed Vagodspeed is offline Need Macro to Copy Notes from one PPT to another Windows 11 Need Macro to Copy Notes from one PPT to another Office 2019
Novice
 
Join Date: Sep 2023
Posts: 4
Vagodspeed is on a distinguished road
Default

Thanks a lot for your effort here! I will try your suggestions.
Reply With Quote
  #12  
Old 09-25-2023, 08:52 AM
Dan_nn Dan_nn is offline Need Macro to Copy Notes from one PPT to another Windows 10 Need Macro to Copy Notes from one PPT to another Office 2021
Novice
 
Join Date: Apr 2023
Posts: 7
Dan_nn is on a distinguished road
Default

Hey, I've uploaded a slightly customized version of the script already inserted in a macro-enabled Powerpoint file (pptm). Feel free to use it.

Here's the actual script I'm using:

Code:
Sub switchNotes(mySource As String, myTarget As String)
' Target and Source files should be open
' oSource and oTarget should be filled with filename (no path) // now passed via arguments
' call switchNotes("SOURCE NOTES","TARGET contains localized graphics")
' source means source notes.
' 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)
Set oTarget = Presentations(myTarget)
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
So, you need to open this file, and additionally open the 2 other files:
- The source, where you already have the notes.
- The target, where you want the notes copied over.

Take note of the filename of those files, let's say the source is called "myPowerpointFile.pptx" and the target is called "myBlankpowerpointFile.pptx".

So now you have the 3 files open.

While viewing the script file ("speaker notes copy script.pptm"), hit alt+F11 and it will open the scripting interface. Check if you have the "Immediate" pane open. If it's not, go to View > Immediate Window, so you open it.

While on the Immediate Window, type:
Code:
call switchNotes("myPowerpointFile.pptx","myBlankpowerpointFile.pptx")
(please note I've used the example filenames, update matching YOUR own filenames).

That's it... if you see any error, try re-running it (sometimes, for a reason I don't know, it may fail the first attempt).

Good luck with it
Attached Files
File Type: pptm speaker notes copy script.pptm (37.5 KB, 3 views)
Reply With Quote
  #13  
Old 09-27-2023, 03:15 AM
Vagodspeed Vagodspeed is offline Need Macro to Copy Notes from one PPT to another Windows 11 Need Macro to Copy Notes from one PPT to another Office 2019
Novice
 
Join Date: Sep 2023
Posts: 4
Vagodspeed is on a distinguished road
Default

Hello!

Thank you again for your effort,
I tried it, as instructed, but I get an error, please see screenshots, which does not go away after the first attempt
Attached Images
File Type: png 1.png (61.5 KB, 5 views)
File Type: png 2.png (41.2 KB, 5 views)
Reply With Quote
  #14  
Old 09-27-2023, 04:17 AM
Dan_nn Dan_nn is offline Need Macro to Copy Notes from one PPT to another Windows 10 Need Macro to Copy Notes from one PPT to another Office 2021
Novice
 
Join Date: Apr 2023
Posts: 7
Dan_nn is on a distinguished road
Default

Hi again.

I see that you are calling the function correctly... wondering what could be the problem.

Please check the following:
- Both files ("PRHR MASK_TRAINING PRESENTATION_notes.pptx" and "PRHR MASK_TRAINING PRESENTATION_NOnotes.pptx") are already open and editable (make sure they are not opened as read only).
- The number of slides in each presentation matches and the starting slide number is similar (whether they start with slide #1 or slide #0).

When you enter the debug mode (where the yellow highlight shows up, in your second screenshot), hover your mouse over the "i" in "oSource.Slides(i)....." and it should show you the value of "i", which would be the slide number where the error occurred... this might help troubleshoot in case there's a particular slide causing the issue... if it's 1, that means it's happening in the first iteration, so there is something preventing the script from working...

You may want to also hove over each variable while stopped in debug mode to double check that each of them is loaded properly... that is, "mySource" and "myTarget" (should have the filenames), "oSource.Slides.Count" and "oTarget.Slides.Count" should both have a number (the count of slides in each presentation, that should be similar)...

Let's see if this helps you figure out what the problem is... I'm happy to take a look at your files if you wish, but I understand that sending your content to someone you don't know is not quite recommended
Reply With Quote
  #15  
Old 10-18-2023, 05:00 PM
ElFinkEl ElFinkEl is offline Need Macro to Copy Notes from one PPT to another Mac OS X Need Macro to Copy Notes from one PPT to another Office 2016 for Mac
Novice
 
Join Date: Oct 2023
Posts: 1
ElFinkEl is on a distinguished road
Default Used to Work But Not Anymore

Quote:
Originally Posted by Dan_nn View Post
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.
I'm wondering if anyone can help me with this. I've used this macro a couple of times successfully, but now it is not working for me anymore. It just copies "1.7.2013". This is driving me nuts! Any advice appreciated.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
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
Need Macro to Copy Notes from one PPT to another Word macro: copy from different tables into one table adisl Word VBA 4 03-25-2014 02:40 AM
Need Macro to Copy Notes from one PPT to another How to do an automation for copy paste, added new row (macro) jpol Excel Programming 1 03-01-2013 05:53 AM
Powerpoint copy notes no1_titch PowerPoint 0 09-07-2010 06:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft