home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 3990
- ClientLeft = 3720
- ClientTop = 6915
- ClientWidth = 6690
- Height = 4395
- Left = 3660
- LinkTopic = "Form1"
- ScaleHeight = 3990
- ScaleWidth = 6690
- Top = 6570
- Width = 6810
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 495
- Left = 2760
- TabIndex = 2
- Top = 1200
- Width = 1215
- End
- Begin VB.TextBox Text1
- Height = 495
- Left = 2760
- MultiLine = -1 'True
- TabIndex = 1
- Text = "msword.frx":0000
- Top = 1800
- Width = 1215
- End
- Begin VB.Label Label1
- Caption = "Label1"
- Height = 495
- Left = 2760
- TabIndex = 0
- Top = 1800
- Width = 1215
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim msword As Object
- Private Sub wordDelLineWith(oldStuff As String)
- msword.StartOfDocument
- msword.EditFind Find:=oldStuff, Direction:=0, MatchCase:=0, _
- WholeWord:=0, PatternMatch:=0, SoundsLike:=0, Format:=0, Wrap:=0
- msword.StartOfLine
- msword.EndOfLine 1
- msword.EditClear
- End Sub
- Private Sub wordReplace(oldStuff As String, newStuff As String)
- msword.StartOfDocument
- msword.EditReplace oldStuff, newStuff, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0
- End Sub
- Private Sub Command1_Click()
- Set msword = CreateObject("word.basic")
- With msword
- .AppMaximize
- .FileNew Template:="Letter2", NewTemplate:=0
- End With
- ' Replace all of the easy stuff. This is all fixed information
- wordReplace "[Company Name]", "Barside Brewery"
- wordReplace "[Street Address]", "123 Lite Road"
- wordReplace "[City, State/Province Zip/Postal Code]", "Pub City, Montana 43255"
- wordReplace "[Recipient Name]", "Jack Tremor"
- wordReplace "[Address]", "1414 Runner Drive"
- wordReplace "[City, State/Province Zip/Postal Code]", "Boston, MASS 12321"
- wordReplace "[Recipient]", "Jack"
- wordReplace "[Your name]", "Rose Switz"
- wordReplace "[Your position]", "Shipping Coordinator"
- wordReplace "[Typist
- s initials]", "dmm"
- wordReplace "[Number]", "0"
- wordDelLineWith "cc:"
- wordDelLineWith "[Type"
- With msword
- .INSERT Text1.TEXT
- .InsertPara
- .FilePrint
- .FileClose 2
- End With
- Set msword = Nothing
- End Sub
- Private Sub Form_Load()
- Label1.AutoSize = True
- Label1.Caption = "Enter the body of the letter below and then click on PRINT."
- Label1.Height = 200
- Label1.Left = 50
- Label1.TOP = 50
- ' Note that this control must be set as
- ' MultiLine=True & ScollBars=2 through
- ' the properties dialog box at design time.
- Text1.Height = 3000
- Text1.Left = 200
- Text1.TEXT = ""
- Text1.TabIndex = 1
- Text1.TOP = Label1.TOP + Label1.Height + 100
- Text1.Width = 4000
- Command1.Caption = " Print Letter"
- Command1.Height = 500
- Command1.Left = 50
- Command1.TabIndex = 2
- Command1.TOP = 3500
- Command1.Width = 4500
- Form1.Caption = "Letter Entry"
- Form1.Height = 4500
- Form1.Width = 4700
- End Sub
-