Visual Basic 6 help

wooonelly

Baseband Member
Messages
91
The following is a VB 6 program written by someone else that I need edited. I am new to this programming thing. This is used as a macro in Word and I would like the Line in RED to be centered on the page when this macro is used. It is used as a header just listing the file name, date, and time. Any help is appreciated


________________________________________________________________
Sub ProgramPrintView()
'
' ProgramPrintView Macro
' Macro created 10/4/2004 by Dan Beck
'
Dim lineNumberAtEnd, deleteAt, i, CharPos1, CharPos2 As Long
Dim rng As Range
Dim temp As String

lineNumberAtEnd = ActiveDocument.Sentences.Count
If lineNumberAtEnd + 62 > 108 Then
deleteAt = lineNumberAtEnd - 46
ActiveDocument.Sentences(62).Select
CharPos1 = Selection.Range.Start
ActiveDocument.Sentences(deleteAt).Select
CharPos2 = Selection.Range.Start
ActiveDocument.Range(Start:=CharPos1, End:=CharPos2).Select
Selection.Delete
ActiveDocument.Sentences(60).Select
temp = Selection
temp = Left(Trim(temp), InStr(Trim(temp), vbCrLf) - 1)
Selection.TypeText Text:=temp & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf
End If
With ActiveDocument.PageSetup.TextColumns
.SetCount NumColumns:=2
End With
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
Set rng = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range
Selection.HomeKey Unit:=wdStory
ActiveDocument.PrintPreview
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
rng.Text = ActiveDocument.Name & " " & Date & " " & Time
rng.Fields.Update

End Sub
_________________________________________________________________
 
The only way I can think of is way more trouble than it's worth.. hWnd scanning then finding the width of the textbox, having it proportional to the screen resolution and then centering it.
 
Back
Top Bottom