Crashes when pasting excel range as table format in powerpoint - excel

I have tried to copy a excel range and paste as table format in powerpoint using excel vba. It pasting the range but when I resize the table the Powerpoint application is crashing.

Your solution helped me to get rid of chrasing powerpoint application. I wrote the table resize function in powerpoint file and executed it.
Thanks alot...

Related

PowerShell: Copy a table from excel then paste to PowerPoint keeping the source formatting

I have tried to use this command below however It's doing to paste the table to the PowerPoint without the excel source formatting:
#Copy table from excel
$sh.Range("A1", "F3").select()
$xl.Selection.Copy()
#Paste table from excel to PowerPoint
$slide = $pp1.Slides.Item($IntSlide)
$TableTemp1 = $slide.Shapes.PasteSpecial($ppPasteHTML,$false,$null,$null,$null,$null)
Could anyone pls help me with a PowerShell script to copy a table from excel then paste to PowerPoint and keep the formatting?

VBA code to transfer data from excel to powerpoint

Is there any VBA code that can be used to transfer data from the excel sheet onto the powerpoint? Currently, I have some data which has been used to generate a chart in excel and this chart is transferred from the excel to a powerpoint using VBA code.The macro is in the excel workbook. However, I would like to transfer the percentage profit from the excel cell over to the powerpoint either as a text or image as shown in the ppt below using VBA (since it is comparing the profit against the latest week[week 16], it should capture the value inside the cell G7). Is there any VBA code available for that? Are there any ways to proceed with this?
Data in excel sheet
Data I want to transfer to the powerpoint

referring to an embedded excel worksheet in powerpoint

I searched in the net and found some similar cases, but they couldn't help me much.
I have an embeded Excel Worksheet in Powerpoint. I want to automatically save the Powerpoint Presentation as a PDF file, using a button.The name of the PDF file should include a number from a particular cell in the Excel Worksheet. I added a button (on the menu taskbar) with a macro, that automaticaly saves the Powerpoint as a PDF. Do you know, how can I refer to the cell in the Excel Worksheet in order to use it for the name of the PDF?
Many thanks for your help in advance!
this gets the first cell in first table in first slide
Debug.Print Application.ActivePresentation.Slides(1).Shapes(1).Table.Cell(1, 1).Shape.TextFrame.TextRange.Text

Error 1004: Microsoft Excel cannot paste the data

I am having trouble copying and pasting some excel charts as pictures and recieving the error: "1004 "Microsoft Excel cannot paste the data." My code finds a premade chart, updates the range, copies the chart, and pastes it into another sheet. The weird thing is that this error is inconsistent where sometimes it will paste a certain chart as a picture and sometimes it won't. I can use similiar code to copy to word with no problems, and if I use the basic copy function, it can repaste as a chart.
This is the functions I am using to copy a chart and paste as a picture:
chtObj.CopyPicture xlScreen, xlPicture
PasteSheet.Paste
If there is something obvious I am missing or if there any work arounds I am open to ideas
Thank you
I have found that for very large points of data it is very easy for excel to lose reference to those points. So if you copy and paste a picture I believe it still in some way keeps a link to those data points which then could be volatile and cause the 1004 error to pop up. My Work around with the help of Floris, chuff, and other SO members was to copy the chartArea and paste using the pastespecial method
ActiveSheet.ChartObjects(chtName).Activate
ActiveChart.ChartArea.Copy
PasteSheet.Select
PasteSheet.PasteSpecial Format:="Bitmap", Link:=False, DisplayAsIcon:=False
Unfortunately it seems the only way to paste to another sheet using pastespecial formatted to bitmap is to select the sheet first paste then re-select the sheet you copied from.
The only thing that worked for me was Paste Special then "XML Spreadsheet". It preserved the integrity of the spreadsheet with my dates and dollar amounts and links to websites.

Exporting Excel data into a PowerPoint presentation

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.

Resources