Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2023, 04:30 AM
yacov yacov is offline text result is too small hard to see Windows 10 text result is too small hard to see Office 2016
Competent Performer
text result is too small hard to see
 
Join Date: Oct 2019
Posts: 139
yacov is on a distinguished road
Default text result is too small hard to see

Hi,
Attached below is a very useful macro written by Macropod and for that I want to thank him again.
and ask if it is possible to increase the text size of the result in this macro.
Also attached is a picture of the resulting text.

Thanks a lot,
Yacov

Sub MyCalculatorSentences()
Selection.Range.Sentences(1).Select
Dim aChar As Variant, aRng As Range, iTotal As Long
Set aRng = Selection.Range
For Each aChar In aRng.Characters
Select Case AscW(aChar)
Case 1488 To 1497: iTotal = iTotal + AscW(aChar) - 1487
Case 1498: iTotal = iTotal + 20
Case 1499: iTotal = iTotal + 20
Case 1500: iTotal = iTotal + 30
Case 1501: iTotal = iTotal + 40
Case 1502: iTotal = iTotal + 40
Case 1503: iTotal = iTotal + 50
Case 1504: iTotal = iTotal + 50
Case 1505: iTotal = iTotal + 60
Case 1506: iTotal = iTotal + 70
Case 1507: iTotal = iTotal + 80
Case 1508: iTotal = iTotal + 80
Case 1509: iTotal = iTotal + 90
Case 1510: iTotal = iTotal + 90
Case 1511: iTotal = iTotal + 100
Case 1512: iTotal = iTotal + 200
Case 1513: iTotal = iTotal + 300
Case 1514: iTotal = iTotal + 400
Case 45: iTotal = iTotal * -1 'a minus sign
End Select
Next aChar
MsgBox iTotal
End Sub
Sub MyCalculatorOr()
Selection.Range.Sentences(1).Select
Dim aChar As Variant, aRng As Range, iTotal As Long
Set aRng = Selection.Range
For Each aChar In aRng.Characters
Select Case AscW(aChar)
Case 1488 To 1497: iTotal = iTotal + AscW(aChar) - 1487
Case 1498: iTotal = iTotal + 20
Case 1499: iTotal = iTotal + 20
Case 1500: iTotal = iTotal + 30
Case 1501: iTotal = iTotal + 40
Case 1502: iTotal = iTotal + 40
Case 1503: iTotal = iTotal + 50
Case 1504: iTotal = iTotal + 50
Case 1505: iTotal = iTotal + 60
Case 1506: iTotal = iTotal + 70
Case 1507: iTotal = iTotal + 80
Case 1508: iTotal = iTotal + 80
Case 1509: iTotal = iTotal + 90
Case 1510: iTotal = iTotal + 90
Case 1511: iTotal = iTotal + 100
Case 1512: iTotal = iTotal + 200
Case 1513: iTotal = iTotal + 300
Case 1514: iTotal = iTotal + 400


Case 45: iTotal = iTotal * -1 'a minus sign
Case 47: iTotal = 0 'reset counter to zero if / encountered
Case Else: Debug.Print AscW(aChar) 'show unhandled characters in Immediate Window
End Select
Next aChar
MsgBox iTotal
End Sub
Attached Images
File Type: png EXAMPLE.png (5.6 KB, 10 views)
Reply With Quote
  #2  
Old 05-11-2023, 10:42 PM
gmayor's Avatar
gmayor gmayor is offline text result is too small hard to see Windows 10 text result is too small hard to see Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The best way to handle this would be to create a simple userform with a label, which can be configured to display any font available at any practical size and use Paul's macros to write the result to the label caption instead of to the message box.
Import the userform from the attached zip file into the same template as the macro code and call it by changing both lines from
Code:
MsgBox iTotal
to
Code:
With frmCalculator
    .Caption = "Total"
    .lblResult.Caption = iTotal
    .lblResult.Font.Size = 24
    .Show
End With
Attached Files
File Type: zip frmCalculator.zip (995 Bytes, 3 views)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 05-12-2023, 12:18 AM
yacov yacov is offline text result is too small hard to see Windows 10 text result is too small hard to see Office 2016
Competent Performer
text result is too small hard to see
 
Join Date: Oct 2019
Posts: 139
yacov is on a distinguished road
Default

Thank you very much, works great.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling data from MenaData and BioData in result sheet based on employee id and then result in resul aligahk06 Excel 2 09-07-2019 02:23 PM
Data Compare and result as true or false in result sheet aligahk06 Excel 1 08-29-2019 06:44 AM
text result is too small hard to see searching a small text in a bigger text using VLOOKUP Tesla Excel 6 04-05-2019 05:48 AM
text result is too small hard to see One Cell that controlls spread sheet result button to change simple fomula result RAH Excel Programming 5 03-31-2018 04:52 PM
text result is too small hard to see Hard space in justified text czytajsk Word 6 06-27-2012 05:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft