VBA从Textframe剪切数据并在其外部过去(MS Word 2013)问题 [英] VBA Cut Data from Textframe and past outside it (MS Word 2013) Problem

查看:144
本文介绍了VBA从Textframe剪切数据并在其外部过去(MS Word 2013)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   

您好,我在word vba(办公室2013)工作,我想从文本框架或文本框中剪切数据以粘贴到文本框架之外 
$
i使用以下代码来执行此操作操作,但它适用于新文件,我从旧文件或保存文件中剪切粘贴文本框架,并且不用于真正的文件,其中textframes由用户自然放置,我无法理解在哪里是问题,这些文件和如何解决之间的差异是什么?


 请帮助我找到问题,为什么它不适用于文本框架所在的真实文件以及其他文本



它显示错误


运行时错误5917

对象不支持附加文本





 Sub fromtxtbox()

For Each s In ActiveDocument.Shapes
Selection.Collapse WdCollapseDirection.wdCollapseEnd

s.TextFrame.TextRange.Cut
Selection.PasteAndForma t(wdFormatOriginalFormatting)


下一个
end sub







这对某些文件运行正常,而不是某些文件也是如此b

是的我想在同一个地方准确切割数据在放置文本框架并希望在剪切过去操作后删除空文本框架的情况下,plz也可以帮助这些编码



解决方案

你好Fahad,


根据你的描述,它似乎与你的文件有关。我建议你通过OneDrive分享我们一个文件,但是我们可以尝试重现你的问题。


最好的问候,


爱德华


   

Hi there, i m working in word vba (office 2013), i want to cut data from inside textframe or textbox to paste outside the textframe 
i used following code to do such operation, but it works on new files, where i cut paste textframes from old files or saved files,
 and do not work on real file where textframes are naturally placed by user, i cant understand where is problem and what is diffrence between these files and how to solve

 please help me find the problem that why does it not work on real file where textframes are places along with other text

it shows error

run time error 5917
the object does not support attached text



Sub fromtxtbox()

For Each s In ActiveDocument.Shapes
 Selection.Collapse WdCollapseDirection.wdCollapseEnd

s.TextFrame.TextRange.Cut
    Selection.PasteAndFormat (wdFormatOriginalFormatting)
    
  
Next
end sub




this run fine on some files and not on some files also

yes i want to place cut data accurate on same place where textframe is placed and want to delete empty textframes after cut past operation, plz also help with these codings

解决方案

Hi Fahad,

Based on your description, it seems to be related with your files. I would suggest you share us one file through OneDrive which did not work, and then we could try to reproduce your issue.

Best Regards,

Edward


这篇关于VBA从Textframe剪切数据并在其外部过去(MS Word 2013)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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