From: Alex on 5 Feb 2010 02:53 Hi, Jay. It seems that I hastened to the findings. First of all, this code fails on some end user computers, but it doesn't on my developer's machine. I changed it as follows (C#): InlineShape sh = ctrl.Range.InlineShapes[1]; Range rng1 = sh.Range; rng2 = ctrl.Range; object direction = WdCollapseDirection.wdCollapseEnd; rng2.Collapse(ref direction); int i = rng2.Move(ref unit, ref cnt); rng1.Select(); //this line was added Application.Selection.Copy(); rng2.Select(); //this line was added rng2.Paste(); Shape shape = rng2.InlineShapes[1].ConvertToShape(); After adding range selection, the code started to work normally on other computers. But then I got another error: If content control is located in the header (footer), then there is an exception "Index refers beyond end of list." at: rng2.InlineShapes[1].ConvertToShape();. Should I use another way to manipulate content controls in header? Thanks in advance.
First
|
Prev
|
Pages: 1 2 Prev: Word VBA FilePrint Function Next: Problem sending mail in office 2007 and windows7 |