PDA

View Full Version : Cut data from Textframe MS word 2013 vba



sindhu2352
03-03-2017, 04:16 AM
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, yes real files are unicode arabic

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