|
25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more... |
Home Projects Up Sitemap Search Blog Forum+Chat About Us Privacy Terms of Use Feedback FAQ Images Services Ads Donate Humor |
Makes it easier to edit a C or C++ file in Word. It attaches the CPROGRAM.DOT template to the current document, making its CPP toolbar and macros available, changes the font to Courier New 10 (a monospaced font), and sets the tab stops to 1/3" (4 spaces). Macros in CPROGRAM.DOT allow reformatting the entire file for improved readability.
This macro should be placed in your Normal.dot.
Attaches the CPROGRAM.DOT template to the current document, making CPP macros available, and changing fonts.
Sub MAIN
REM 1-31-99, 1/15/04
REM Copyright (C)1999-2005 Steven Whitney.
REM Initially published by http://25yearsofprogramming.com.
REM Published under GNU GPL (General Public License) Version 2, with ABSOLUTELY NO WARRANTY.
REM Attaches CPROGRAM.DOT to active document in preparation for file EDITING.
REM makes my CPP macros available and changes the font and tab stops.
REM if you convert a document and save it, it remains based on cprogram.dot,
REM which has different tab stops,
REM but Word 6.0 seems to have a bug, and any document NOT based on normal.dot
REM can sometimes hang for a minute or more upon exit. If you tell the dialog box
REM you don't want to wait, the file usually turns out to have been saved ok, but I think not always.
If MsgBox("To convert an ordinary document to 10cpi, just change the font to CourierNew 10. Converting it to CPP has some undesirable side effects. CONVERT to a .CPP program file?", "Are You Sure?", 33) <> - 1 Then Goto bye
REM Turn off everything related to autocorrect.
REM This is important when you're about to edit an actual CPP file.
ToolsAutoCorrect .SmartQuotes = 0, .InitialCaps = 0, .SentenceCaps = 0, .Days = 0, .ReplaceText = 0, .Formatting = 0, .Replace = "", .With = ""
FileTemplates .Store = 0, .Template = "c:\msoffice\winword\template\cprogram.dot", .LinkStyles = 1
REM SET TABS TO 4 CHARS AT 12CPI = 1/3"
FormatTabs .Position = "", .DefTabs = "0.33" + Chr$(34), .Align = 0, .Leader = 0
REM DISPLAY THE PROGRAMMING TOOLS TOOLBAR
ViewToolbars .Toolbar = "Programming Tools", .Show
If MsgBox("Turn AUTOCORRECT back ON?", "Configure", 36) = - 1 Then
ToolsAutoCorrect .SmartQuotes = 0, .InitialCaps = 1, .SentenceCaps = 1, .Days = 1, .ReplaceText = 1, .Formatting = 0, .Replace = "", .With = ""
EndIf
bye:
End Sub
|
|
|
|
|
|