Word/Excel Macro thread

Discussion in 'Software Q&A' started by sms_solver, Dec 22, 2004.

Thread Status:
Not open for further replies.
  1. sms_solver

    sms_solver New Member

    Joined:
    Jan 2, 2004
    Messages:
    420
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    somewhere
    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:

    [​IMG]

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

    sms_solver New Member

    Joined:
    Jan 2, 2004
    Messages:
    420
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    somewhere
    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)
     
  3. OP
    OP
    sms_solver

    sms_solver New Member

    Joined:
    Jan 2, 2004
    Messages:
    420
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    somewhere
    No body to post useful macros
     
Thread Status:
Not open for further replies.

Share This Page