Pasting Text from Excel cell to Powerpoint Title Box

  • Thread starter Thread starter sukhin
  • Start date Start date
S

sukhin

I have some text in an Excel Worksheet that I need to transfer to a
slide title in powerpoint.

I am currently using the following code:

' Add Title Text to Slide
ppNewSlide.Shapes.Placeholders(1).TextFrame.TextRange.Text = sTitle

sTitle is a variable that is populated from a cell in Excel ( sTitle =
NameRange.Value).

The problem I am having is that line breaks that I enter in the Excel
cell using Alt+enter do not carry over to the Powerpoint slide title.

Any help would be greatly appreciated.

Thanks,

Sukhin
 
I have some text in an Excel Worksheet that I need to transfer to a
slide title in powerpoint.

I am currently using the following code:

' Add Title Text to Slide
ppNewSlide.Shapes.Placeholders(1).TextFrame.TextRange.Text = sTitle

sTitle is a variable that is populated from a cell in Excel ( sTitle =
NameRange.Value).

The problem I am having is that line breaks that I enter in the Excel
cell using Alt+enter do not carry over to the Powerpoint slide title.

Any help would be greatly appreciated.

I'm guessing that Excel embeds a special character in the text to indicate the
linebreak. Use something like this to work out what it is:

For x = 1 to Len(ExcelText)
Debug.Print Asc(Mid$(ExcelText,X,1))
Next

Then (assuming you use PPT2000 or higher) use this before assigning sTitle to
the text range:

sTitle = Replace(sTitle, ExcelLineBreakCharacter, Chr$(11))
 
Back
Top