0
votes

I have connected Excel and Powerpoint via VBA to send values from the Excel sheet to the PPT.

All is working well except one thing: I need to transfer values from cells in Excel to text box shapes in ppt while preserving the number formatting from excel. How do I do that?

I do this for about 10 such boxes and my current code using copy from excel and paste in powerpoint, keeps on giving out of range error on random places.

Will paste the code I am using in a short while.

1
waiting to see your code. How are you copying from excel to PPT Textbox?Siddharth Rout

1 Answers

0
votes

Try using the numberFormat from Excel when you bring over the Value.

Example:

With Workbooks(1).Sheets(1).Range("A1")
    valueToPaste = Format(.Value, .NumberFormat)
End With

For the sake of the example, I'm pretending you are calling this from Excel and only want to know how to extract the value with it's format. We are using the first sheet of the first workbook in Range A1. It should be easy enough to update to your specific needs.

There are probably some exceptions, particularly for custom formats, but this should work for the majority of formats you would use in Excel.