I am writing a VBA code in Excel 2010 to search for a particular text (
that I am inputting from Excel) in a Presentation, cut that slide and paste the slide next to slide where the same text (again inputting from Excel) is found in the Presentation.
And I want to repeat the same for around 50 times, i.e, I want to find 50 texts in PPT and cut those slides and paste them somewhere else.
Can I do this using Excel VBA code??
Yes.
You'll need to add PowerPoint's Object Library and look up the existing solutions with Google.
Related
My question is quite simple but I couldn't find a solution anywhere.
Here it is:
I do want to copy a chart from a slide and paste it to another with VBA.
I am doing it manually and it is time consuming for no reason, there are a lot of charts like that. I do want to automize it.
To be more specific:
There is a chart in slide number 37 -> Chart I want to Copy
I want to copy that chart in slide number 37 -> Slide I want to Paste
And paste it to slide 36 while preserving formatting, size, position etc. -> Wanted final result
I hope it has an easy solution and I can find anyone who wants to help.
Thanks in advance!
edit:
I can copy charts excel to powerpoint using scripts like that:
Paste Excel Chart into Powerpoint using VBA
but cannot find a way for powerpoint to powerpoint (itself)
I've set up a macro that copy/pastes graphs and tables from a spreadsheet to specific slides in a pre-existing PowerPoint presentation using excel VBA. In the code, I have to specify the exact slide number to copy the excel graph to (done 100+ times).
The issue is that when slides are added/deleted from the presentation in the future, the slide numbers will change and I will have to go through the code and manually update each slide reference.
I'm looking for a way to name slides in PowerPoint then use those names in my excel vba code? Eliminating the risk of slides being added/deleted later on (which will definitely happen).
This post is similar in concept( vba powerpoint select a slide by name), but I can't seem to get it working using the excel vba.
An excerpt of the code I'm using to paste a graph is below. Instead of referencing slide 54, I'd rather use a named slide like "Performance":
Set oPPT = GetObject(, "PowerPoint.Application")
Set presUpdate = oPPT.Presentations("Presentation Name")
With presUpdate.Slides(54)
.Shapes.PasteSpecial(DataType:=xlBitmap).Select
.Shapes("Picture 1").Left = 34.01559
.Shapes("Picture 1").Top = 96.36512
End With
Thanks
Suppose you have 3 topics, Performance, Issues and Sales
In the master layout of the PowerPoint document create 4 slide layouts and rename them to
Performance
Issues
Sales
Others
Once that is done, sort and paste all the content according to the topics (yes this is a painful process, but its one time), by right clicking on the slide and choosing one of the 4 layouts.
If the document contains 100 slides, the below is the scenario
Performance: 20 slides
Issues: 30 slides
Sales: 10 slides
Others: 40 slides
Even if they are reordered you can write a macro that can search for the slide name and relevant changes can be done.
The main point here is that the SLIDE NAME is your INDEX and having them sorted like this will help you in the long run.
Hope this answers your question
I have an excel spreadsheet in which I dynamically insert pictures of smileys based on numbers in column A (if positive a happy smiley appears, if negative a sad smiley appears).
A B C
1 5% happy smiley
2 8% happy smiley
3 -4% sad smiley
4 -3% sad smiley
This function works perfectly within Excel.
Now, I want to transfer the pictures of the smileys
into a PowerPoint presentation with the Paste Link function.
The same way I can insert charts from Excel to PowerPoint.
However, it seems that I can not use this option for the picture.
Do you have any idea how to solve this issue and to copy
the dynamic smileys from Excel to PowerPoint?
I assume you just want to copy the smileys to show them in your presentation?
If you do so, you can, in powerpoint, while pasting them, select "as graphic" or something like this. I'm not at a computer right now to test it out, but this should work.
Edit
Source for this answer: this link here
Copy the corresponding cells in excel. In powerpoint, go to "home", then there on the paste button to the submenu and select "special paste" or so. Then you can select "shortcut" or "link" or whatever like in this image. It should now update when you update the cells in excel.
I have a template presentation on powerpoint.
I would like to replace automatically generic placeholders with the value I input in an linked excel worksheet.
I started looking at VBA at the begining of the week, I am not really yet familiar with the syntax, but I am optimistic I will find a way to understand it.
I have put "[ ]" everywhere I want a value input:
the excel sheet present itself like this:
I would like to have some pointers (first, to know if it is indeed possible in powerpoint) to get me started in the right direction.
Does it need to be a PublicSub()?
Am I writing the macro on Powerpoint or in Excel?
Can I use a fonction similar to LookupV to get the values to replace the placeholders?
I would imagine something like :
(side question : can I use regex inside of VBA?)
for each "\[.\]" '(or characterString.startsWith("[")
lookup characterString in excel, return column 3
end each
Would this be possible?
Thank you in advance, I really appreciate the help.
Found an approximate solution, but simpler than code writing.
Open Excel,
fill the values, and copy them onto the powerpoint presentation : use the special paste option between the cell (or cells/cell range) you want.
Choose the "paste the link" option together with object worksheet Excel, select Ok.
Both files will be linked. You can change the values in Excel, and they will change also in powerpoint. The formating is done on excel.
In order to update all the values in the powerpoint after changing them on excel, powerpoint needs to be re-run, and at the restart of the application, accept the updating box prompt.
I find this simpler than the other solutions.
I am trying to write an add-in for Powerpoint, the user should be able to select cells in an Excel worksheet and then go to the Powerpoint slide he would like to paste that table in, after starting the Add-in, a macro should create a table and copy cell by cell. Afterwards the macro will format the PowerPoint table according to our formatting guidelines. I am running into some issues now:
1) How can I go through the cells within a selected range in Excel, I tried to loop through the cells within the selected range, but neither this nor counting the rows/columns with in the selected range works (I am rather unfamiliar with Excel VBA)
2) What is the best way to copy data from Excel to Powerpoint? I have seen some suggestions that use a string array, that reads in all the data first; some users re-use one variable to copy the data and some do it directly from a XL to a PPT reference, what are the advantages of the different approaches?
Thanks a lot
s
For your first question, here is a snippet of code that works (yet, it depends on what you intend to do):
Dim C As Range
For Each C In Range("A1:A100")
'do stuff
Next C
For your second point, it depends on the results you expect :
a PowerPoint formatted array
an Excel Object embedded into PowerPoint
copy-paste the values inside the slide content
Once you have chosen, it's easy to find ressources on the web to do what you want.