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

Prepare to edit a C or C++ file in MS Word 2003

AttachCProgramDOT

Attribute VB_Name = "AttachCProgramDOT"

Public Sub MAIN()
Attribute MAIN.VB_Description = "Attaches CPROGRAM.DOT template to current document, making its C++ formatting macros available, and changing fonts."
Attribute MAIN.VB_ProcData.VB_Invoke_Func = "TemplateProject.AttachCProgramDOT.MAIN"
Rem 1-31-99, 1/15/04
Rem Copyright (C)1999-2005 Steven Whitney.
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, and can hang up MSWord when it exits.
If WordBasic.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.
WordBasic.ToolsAutoCorrect SmartQuotes:=0, InitialCaps:=0, SentenceCaps:=0, Days:=0, ReplaceText:=0, Formatting:=0, Replace:="", With:=""

WordBasic.FileTemplates Store:=0, Template:="c:\msoffice\winword\template\cprogram.dot", LinkStyles:=1

Rem SET TABS TO 4 CHARS AT 12CPI = 1/3"
WordBasic.FormatTabs Position:="", DefTabs:="0.33" + Chr(34), Align:=0, Leader:=0

Rem DISPLAY THE PROGRAMMING TOOLS TOOLBAR
WordBasic.ViewToolbars Toolbar:="Programming Tools", Show:=1

If WordBasic.MsgBox("Turn AUTOCORRECT back ON?", "Configure", 36) = -1 Then
    WordBasic.ToolsAutoCorrect SmartQuotes:=0, InitialCaps:=1, SentenceCaps:=1, Days:=1, ReplaceText:=1, Formatting:=0, Replace:="", With:=""
End If

Bye:

End Sub

 

 

Valid HTML 4.01 Transitional Valid CSS
View content labeling at ICRA.
Copyright ©2007 Steven Whitney. Last modified 09/25/2007.