将数据从Powerpoint文本框复制到Excel单元格 [英] Copy data from powerpoint textbox to Excel cell

查看:66
本文介绍了将数据从Powerpoint文本框复制到Excel单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MS Excel中的宏将数据从PowerPoint的文本框中导入到Excel.

I am using macro in MS Excel to import data from textbox in PowerPoint to Excel.

它以文本格式导入数据,因此无法从文本框中复制换行符

It's importing data in text format not able to copy new line characters from textbox

Range("a1").Value = pps.Shapes("textbox 1").TextFrame.TextRange.Text

有人可以建议替代解决方案吗?

Can anyone please suggest alternative solution?

推荐答案

PowerPoint的最新版本使用Chr $(11)作为换行符.看来Excel想要换行Chr $(10),所以像这样:

Recent versions of PowerPoint use Chr$(11) as a linebreak character. It looks like Excel wants a linefeed Chr$(10), so something like this:

Range("a1").Value = Replace(pps.Shapes("textbox 1").TextFrame.TextRange.Text,Chr$(11), Chr$(10))

PPT段落结尾和换行符使用不同的字符,并且版本之间有所不同,因此,如果需要支持PPT 2003及更早版本,则需要更多代码.

PPT uses different characters for paragraph endings vs line breaks, and it varies somewhat between versions, so if you need to support PPT 2003 and prior, you'll need a bit more code.

我维护的PPT常见问题解答上的此页面详细说明:

This page on the PPT FAQ I maintain explains the details:

http://www.pptfaq.com/FAQ00992_Paragraph_endings_and_line_breaks.htm

这篇关于将数据从Powerpoint文本框复制到Excel单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆