Microsoft-Word custom form
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I need to place the output of this MS Word macro into a "custom form"

The form should match the Font Face of the MS Word tree.

See video: http://tinyurl.com/y4kdwsnp

old code and test DOC: http://tinyurl.com/yydnsw97

awarded to mashtullah

Crowdsource coding tasks.

1 Solution


I have edited your macro abit and and created a new Userform to show the output. The output font and size is as specified in the video.
Below is the link to the macro-enabled word document i created containing my changes, test it out and let me know if you have any issues.

https://drive.google.com/open?id=15L74L4ZkKo55-pte5sXr_mJJRpK_n0Bx

This is the updated version

https://drive.google.com/open?id=1dUKrzBX1iFZxEs0si1Fx-cp655LDbzgA

Second Update, i have now created the labels during runtime so as to adjust the spacing between them.
Below is the link

https://drive.google.com/open?id=17XAEXyAlj86uHFy2X4dHvN-vc7W2C7aW

I know their might be a very slight difference in alignment due to screen resolution and other reasons, but on my computer its aligned, so incase on your end it is not, please adjust the currentTop variable.
check the line below

currentTop = lblOutput.Top + lblOutput.Height + 1.4
to decrease the spacing decrease the last value which is 1.4 to maybe 1 or 1.2. To increase the spacing just increase that last value.

Now you will have to do that twice, since i write on the first label then i write on the other labels inside the loop.

Incase of any queries let me know...

I think that's good. The font-size is correct. But can you increase the line-spacing between lines. see image https://i.imgur.com/lGVYr6R.gif
tonloc 7 months ago
Also, can you make sure that numbers with over 3 characters have a comma. e.g. like 9,999
tonloc 7 months ago
In VBA a label doesn't have a line-spacing property, it's the font that decides how much space will be between each line of text within the label... I have updated the comma separator on the numbers and added the new link on my answer
mashtullah 7 months ago
Yes I know. Maybe you can put the text in a textbox and use the http://tinyurl.com/y3f2kf2o Lineheight property. Or, maybe you can create an instance of a text label, for each H1 line. It's really important that the form text line-up with the ms word tree. Else, it's not very useful.. I'll give you a tip.
tonloc 7 months ago
Working on it now... FYI the TextBox.LineHeight property only applies to .Net and not VBA
mashtullah 7 months ago
Thanks for the tip, God Bless you!
mashtullah 7 months ago
ok thanks, why are there 2 forms?
tonloc 7 months ago
Please delete the first form, the working form is called frmMain hope this worked for you! keep those VBA bounties coming...
mashtullah 7 months ago
Thanks, do you know if macros MUST be saved in a DOCM file? e.g. can i somehow save the macro as "a part of MS Word" - so that my book file does not need to be a DOCM file.
tonloc 7 months ago