Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
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
  #2  
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
  #3  
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



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 05:17 PM.


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