Word/Excel Macro thread

Status
Not open for further replies.

sms_solver

In the zone
I have started this thread so that one can put code or links for intresting and useful macros for MS Office product.

Here is my contribution -- A word Macro

Click Tools > Macro > Macros …, a Macro dialog box will appear. Type ListFonts at new Marco name and click on Create Button. This will open Visual Basic Editor. Write following code as shown in the picture and then save and close Visual Basic Editor. Now run the macro and see what happens – it displays all the fonts in their respective fontface. :lol:

*www.geocities.com/lowlowlownp/m_listfonts.gif

-----------------------------------------
If anybody have such useful macros for word/excel, plz give the link or code!
 
OP
sms_solver

sms_solver

In the zone
This is yet another word macro which finds C or C++ comments that starts with /* and ends with */. This is just an example to show how a pattern can be searched and manipulated.

Code:
Sub FindComments()
'
' FindComments Macro created by sms_solver on 12/24/2004
' USE: This macro finds C or C++ multiline comments in a document and
'      change its color and make it italic

Dim findYes As Boolean

'Goto top of the document
Selection.HomeKey Unit:=wdStory
Do
    findYes = Selection.Find.Execute("/\*?*?\*/", , , True)
    Selection.Font.Italic = True
    Selection.Font.Color = wdColorDarkBlue
Loop While findYes

End Sub

8)
 
Status
Not open for further replies.
Top Bottom