Pasting Text from Excel cell to Powerpoint Title Box

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
 
S

Steve Rindsberg

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))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top