#1
|
|||
|
|||
Is it possible to make a macro for inserting a 'division box?'
I am using Word 2007 and am trying to make long division problems in which the dividend appears in the (hard to describe, here) traditional 'division box' that we all were presented with in elementary school, which looks like a closing parenthesis followed by an overbar. I don't want to use the forward slash, such as this: 24/2500, but rather 24)2500, where the '2500' has an overbar above it. I have searched elsewhere, and have found that I can use the following sequence for any given problem: Type the divisor>Type a closing parenthesis>Type the dividend>Insert>Equation>Accent>Overbar>Enter. This renders a pretty good/usable division problem; however, as can be seen, it's kind of a long, drawn-out hassle, when trying to make several problems. Thus my questions: Is there a better way to make such a division-problem format? If not, might I be able to, somehow, make a macro consisting of the above-mentioned sequence of keystrokes that would do the trick, allowing me to quickly insert it, then fill in the numbers? I'm not that Word-savvy, so any help would be greatly appreciated. |
#2
|
||||
|
||||
Creating such equations with VBA using the equation editor gets fairly complex. See: https://software-solutions-online.co...ing-equations/
A simpler alternative might be to use an EQ field. For example: Code:
Sub LongDivision() Dim StrVal As String, Fld As Field StrVal = Trim(InputBox("Amount to divide")) Set Fld = ActiveDocument.Fields.Add(Range:=Selection.Range, Type:=wdFieldEmpty, _ Text:="EQ \s\up6(\f(,\)" & StrVal & "))", PreserveFormatting:=False) Fld.Code.Text = Trim(Fld.Code.Text) Set Fld = Nothing End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Footnote extraction macro [Why is this macro so slow? / anyway to make it faster?] | Le_Blanc | Word VBA | 10 | 03-22-2021 11:38 AM |
Equations - Bracketed division size | Dan110024 | Word | 0 | 09-03-2015 11:10 PM |
Division by Zero error | Nate | PowerPoint | 1 | 11-29-2012 10:51 PM |
No paragraphs division | hbrt | Word | 1 | 01-24-2012 05:01 PM |
division zero escape? | gmyls | Excel | 2 | 05-22-2009 02:37 AM |