#1
|
|||
|
|||
Declare Constant for Chr(14)
Word has built-in constants such as vbCr = Chr(13) and vbFormFeed = Chr(12). How can I declare my own constant vbColumnBreak = Chr(14)? Word VBA compiler objects to "Chr" in the following declaration: public const vbColumnBreak as string = Chr(14) |
#2
|
||||
|
||||
Check the WdBreakType Enumeration in the VBA Help file:
Const wdColumnBreak As Long = 8
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
I think the usefulness of constant depends on how you intend to use it. Assuming we assign the value as 8, then these two lines yield significantly different results.
Selection.InsertBreak Type:=8 Selection.TypeText 8 I assumed that VBorNotVB was looking to include the break as a character so it could be included in strings inserted into ranges or selections.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
||||
|
||||
If one develops code using early binding, which allows the use of Word constants, but needs to distribute the code using late binding, declaring the constants allows their names to be retained in the code.
Amongst other things, that also makes it easier to see what the late-bound code is doing.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Declare wBk as workbook. Set wBk = workbooks("NewBook.xls") gives error: Subscript out of range. | Syed Shabbir | Excel Programming | 1 | 09-27-2020 09:35 AM |
constant request for password for Outlook.com | workingmom | Outlook | 0 | 10-20-2016 12:37 PM |
Constant Request for Server Passwords | danpbphoto | Outlook | 1 | 01-12-2015 07:28 AM |
Keep cell in formula constant | jprt68 | Excel | 1 | 06-26-2012 08:31 AM |
Keeping the top row constant in Excel | MSmand | Excel | 2 | 07-13-2011 01:14 PM |