Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 11-28-2005, 03:39 PM   #1
Baseband Member
 
wooonelly's Avatar
 
Join Date: Nov 2005
Posts: 91
Default Visual Basic 6 help

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.DifferentFirstPageHeaderF ooter = True
Set rng = ActiveDocument.Sections(1).Headers(wdHeaderFooterF irstPage).Range
Selection.HomeKey Unit:=wdStory
ActiveDocument.PrintPreview
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
rng.Text = ActiveDocument.Name & " " & Date & " " & Time
rng.Fields.Update

End Sub
__________________________________________________ _______________
__________________

wooonelly is offline   Reply With Quote
Old 11-28-2005, 07:25 PM   #2
BSOD
 
MarxSoccer's Avatar
 
Join Date: Jun 2005
Posts: 2,999
Send a message via ICQ to MarxSoccer Send a message via AIM to MarxSoccer Send a message via MSN to MarxSoccer Send a message via Yahoo to MarxSoccer
Default Re: Visual Basic 6 help

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.
__________________

MarxSoccer is offline   Reply With Quote
Old 11-30-2005, 09:29 AM   #3
Baseband Member
 
wooonelly's Avatar
 
Join Date: Nov 2005
Posts: 91
Default Re: Visual Basic 6 help

Kind of what I thought. thank you.
wooonelly is offline   Reply With Quote
Old 11-30-2005, 04:49 PM   #4
BSOD
 
MarxSoccer's Avatar
 
Join Date: Jun 2005
Posts: 2,999
Send a message via ICQ to MarxSoccer Send a message via AIM to MarxSoccer Send a message via MSN to MarxSoccer Send a message via Yahoo to MarxSoccer
Default Re: Visual Basic 6 help

Yep, sorry
MarxSoccer is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0