I have a highly customized PowerPoint template with a layout named "Title and Content".
When I copy paste (using Destination theme option) a "Title and Content" slide from a presentation based on my customized template to default Office template based presentation, pasted slide ended up with a layout named "1_Title and Content" even though default Office template has "Title and Content" layout.
I was expecting copy pasted slide to follow destination theme and use layout available if layout names are matching. Any idea why that is not happening in this case? How do I force such a behavior using VSTO?
If your layout were exactly identical to the existing one, PPT would use the existing one. If it's the least bit different, to avoid corrupting either the pasted slide or the other existing slides, PPT will give you those #_XYZ numbered+named layouts.
You can't prevent it.
You can, instead, write code to look for these #XYZ layouts, find the matching layout w/o the # and apply it to the slide, then delete the #_ version of the layout.
Or, possibly, instead of copy/pasting the slide, create a new slide in the target presentation (based on the same layout as the source slide), then copy/paste the content into it.
Related
I have a PowerPoint presentation containing Excel charts and .png files. This presentation needs to be updated fairly often and I’d like to use VBA for this. However, I’ve read up on linking charts from Excel to Powerpoint and it seems not to be bug-free, but I don't really know anything about it.
So I need advice what makes the most sense because I don't have any experience with this. Is updating the charts usually not an issue? Or would it be more fool-proof to delete the old charts and insert the new ones? In case it's the latter, would I simply define the dimensions of the chart or does the use of placeholders offer any advantages?
What I've done in the past is use VBA to paste pictures of the charts into the slides. Then the presentation serves as a snapshot, and I don't need to worry about links.
You can set up a table with details like chart name, worksheet name, slide number, image size (width, height) and position (left, top). Then the code moves down the list, finding the worksheet, copying the chart, activating the slide, pasting the chart as a picture, moving it into position. Best results are when the chart is sized right in Excel so you don't need to resize it in PowerPoint.
It's been a while, so I don't have that code at my fingertips. I'll hunt around when I have a chance.
I have a Powerpoint file with many charts that I expect many different users to use with their own data. I'm trying to make this Powerpoint as easy to use as possible by writing VBA into each data source (by data source, I mean the default Excel sheet that is embedded in Powerpoint when you select "Insert" > "Chart"). My goal is to allow them to click the chart, select "Edit data," paste info from a PivotTable into the Excel window that pops up, and let the macro does the rest. The code I can write myself, but I have a different problem:
I've tried writing macros in these embedded Excel files but they do not save once they are closed (I assume they must be .xls or similar and not .xlsm). How can I get these macros to save? I've tried drag and dropping .xlsm files into Powerpoint, but it shows the actual charts on the slide and it's difficult to work with. I'd like the Excel files to be hidden from Powerpoint view and easily accessed using the "Edit data" option.
I hope this description makes sense, if not I can explain further / answer any questions.
Thanks!
Can't you just provide PowerPoint charts, and have them paste data into each chart's DataSheet in PowerPoint?
Of late, PPT does its best to convert pasted charts into PowerPoint charts (same basic engine as Excel charts but they're not Excel objects). You can get round this if you copy the chart from XL, switch to PPT and on the Home tab, click the downward pointing arrow below Paste, pick Paste Special and choose to paste as embedded Excel chart object.
You can then doubleclick the pasted object and Excel will launch for in-place editing.
Or you can right-click, choose "Macro enabled worksheet object" or whatever, and then opt to Open or Edit. Edit gives you in-place editing within the PPT window, Open launches the embedded data in a full copy of Excel.
I have a template in excel, and a powerpoint template.
in the powerpoint template I have several charts linked to the excel template.
I want to make a loop that changes something in excel, so that the chart updates, "saveas" for both the excel and powerpoint file, so I have eg. 100 different excel files and 100 different powerpoint files, all build on the templates. I want to be able to manually alter some data in those 100 excelfiles, with the link to powerpoint still intact, so they are updated too if needed.
however, when I open the powerpoint templates, right click on a chart and select "edit data", then the chart is still linked to the excel template, not the saveas version of the excel file?
how do I change the link of a chart in powerpoint, to a different excel filename? the structure in the two excel files are identical.
the chart is created in excel and copy/pasted as "keep source formatting and chain data" (translated from danish)
any help would be greatly appreciated.
I have also tried a solution where the copy/paste is done via vba into an empty powerpoint template, but that is more time consuming, and powerpoint often crashes.
Assuming you have a reference to the shape represented by the linked chart in oSh, this will show you the link:
Debug.Print oSh.LinkFormat.SourceFullName
And this will change it to some other file:
oSh.LinkFormat.SourceFullName = "c:\some\path\yourfile.xls"
Most likely there will also be a !chartname or the like after yourfile.xls ... you'll need to include that.
And save the Excel files first, THEN change the link in the PPT to point to them. If you change the link to point to a non-existent file, PPT won't throw any errors; it'll simply leave the link unchanged.
I have monthly report data in separate tabs, Jan to Dec.
I took the data from Jan and linked it to a powerpoint page in order to display it for briefings. I have the layout set exactly how I want it, so I copied the slide and then wanted to edit the new slide to use the data from Feb instead of Jan, however I can't seem to update the links so they use the other sheet. It just asks me to select a new file.
The links option allows me to select a new spreadsheet file but not the same file and different sheet. Is there anyway around this?
The data embedded in the ppt is both cell data & charts.
Hopefully, I've explained what I mean well enough.
Many thanks for any help and advice. =)
Your subject mentions links but later you say "The data embedded in the ppt ..."
Linked and embedded objects are two different things with different behaviors.
If you want different slides to point to different parts of your worksheet/workbook and to update at need, you'll want to do this for each slide:
Select the data in Excel
Copy it
Switch to PowerPoint, move to the slide where you want to display the data
Choose Paste Special, then choose to Link
You could, in theory, accomplish something similar by creating one link, then copying the slide and finally editing the link target, but that'd take either an add-in or some coding, and would in any case probably be more trouble than it'd be worth.
Create a tab in the file and name it "Current" or something to that effect.
Link it to the month tab you want, like Jan.
Create the link in powerpoint how ever you have already, to this tab and not the Jan tab.
you can change the links in the tab "Current" to point to a different tab, like Mar.
Update you powerpoint by either up dating links (for pastespecial as link ) or just double click the embedded object in powerpoint while the Excel file is already open
I need to write a VBA code to copy a company logo in the headers/footers of one excel sheet to another sheet in another workbook. Any ideas?
Excel has a handy Record Macro function.
You can initiate that, Copy the footer over, then stop the recording.
Then, review the code, and it should pretty much show you how to do it.
If you are working in anything older than Excel 2007 then it doesn't sound like this is possible without using the original graphic file (e.g. JPG, GIF etc):
Normally, you can copy and paste the
headers and footers from one worksheet
to another by selecting the worksheets
and then using the Header or Footer
dialog boxes (click Custom Header or
Custom Footer on the Header/Footer tab
of the Page Setup dialog box).
However, if the original headers and
footers contain graphics, the graphics
will not propagate to the other
worksheets. The only way to work with
pictures in headers or footers for
multiple worksheets is to select all
the worksheets, and then insert a
graphic by using the Insert Picture
dialog box (click the Insert Picture
button), or format the graphic by
using the Format Picture dialog box
(click the Format Picture button). The
original graphic file is needed for
this procedure.
source
It may be possible in Excel 2007 - see here
One workaround is to copy the original worksheet to the new workbook:
' macro on the source workbook
Sheets("Sheet1").Move After:=Workbooks("Book2").Sheets(3)
When you do this, you get a worksheet in the destination workbook with all the features of the original, including footers and headers, you can then copy all the content you want into the new worksheet