PUB2002: Error Message When You Use AddHorizontalInVertical Method to Create Vertical Text Box (289008)
The information in this article applies to:
This article was previously published under Q289008 SYMPTOMS
When you attempt to use the AddHorizontalInVertical method to create a vertical text box that begins with a horizontally aligned word, you receive the following error message:
-2147467259: You may not have return, tab, or other special characters in Ruby/IHIV text.
CAUSE
This behavior can occur when a newly created vertical text box contains only a default end-of-frame paragraph mark, and the code attempts to apply horizontal formatting to it. This is not allowed.
RESOLUTIONMicrosoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may
want to contact a Microsoft Certified Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please visit the following Microsoft Web site:
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
Make sure that you are not specifying a text range that includes one of the forbidden special characters, such as RETURN or TAB. One way to accomplish this is to add one or more valid characters to the text frame and then specify that text as your text range when you call the AddHorizontalInVertical method. To create code that does this, follow these steps:
- Start Microsoft Publisher, and then open a new blank publication.
- On the Tools menu, point to Macro, and then click Visual Basic Editor.
- On the Insert menu, click Module.
- In the Module window, type the following procedure:
Sub Test()
Dim rngTemp As TextRange
Dim fldTemp As Field
On Error GoTo handler
ActiveDocument.Pages(1).Shapes.AddTextbox _
pbTextOrientationVerticalEastAsia, 100, 100, 100, 100
With ActiveDocument.Pages(1).Shapes(1)
.TextFrame.TextRange.Text = "Test Word"
Set rngTemp = .TextFrame.TextRange.Words(1)
Set fldTemp = .TextFrame.TextRange.Fields _
.AddHorizontalInVertical(rngTemp, rngTemp.Text)
End With
handler:
Debug.Print Err.Number & ": " & Err.Description
End Sub
- On the Run menu, click Run Sub/User Form.
- On the File menu, click Close and Return to Microsoft Publisher.
Notice that Publisher creates a vertical text box in which the first word is displayed horizontally.
Modification Type: | Major | Last Reviewed: | 11/5/2003 |
---|
Keywords: | kberrmsg kbnofix kbprb KB289008 |
---|
|