I have a document that I open up and import data from a Sql Database. I
perform this with VBA code. I make an adjustment to the margins that
changes text entered into the document. It also changes the width of the
headers and footers which is something that I dont want to happen. How do
I keep that from happening with VBA code.
Anne Troy - 26 Oct 2005 22:20 GMT
It sounds, Jim, like you might need to be adjusting indentation on the
paragraphs instead of adjusting margins. You can't really change the margin
without its header and footer too (or not nearly as easily), so perhaps just
using indentation both left and right would help you.
************
Anne Troy
www.OfficeArticles.com
>I have a document that I open up and import data from a Sql Database. I
> perform this with VBA code. I make an adjustment to the margins that
> changes text entered into the document. It also changes the width of the
> headers and footers which is something that I dont want to happen. How
> do
> I keep that from happening with VBA code.
JimS - 27 Oct 2005 18:15 GMT
Thanks Anne
I have tried to adjust the indentation but I dont seem to have the correct
adjustment. I am not sure that I really know where to put the indent to
move the data to the desired format. I appreciate any help to get pointed
to the right direction.
Thanks
The original code (snippet) that I am using is as follows:
With ActiveDocument.PageSetup
.LeftMargin = InchesToPoints(1)
.RightMargin = InchesToPoints(1)
End With
With ActiveDocument.Range(Start:=Selection.Start, End:=ActiveDocument. _
Content.End).PageSetup.TextColumns
.SetCount NumColumns:=2
.EvenlySpaced = True
.LineBetween = False
.Width = InchesToPoints(1.75)
.Spacing = InchesToPoints(0.5)
End With
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
do while not adoRS.eof
' A blank line.
Selection.TypeParagraph
' print the name
Selection.TypeText StrConv(RTrim(adoRS!NAME_TITLE),
vbProperCase) & "." & " "
Selection.TypeText RTrim(adoRS!FIRST_NAME) & " "
Selection.TypeText " " & RTrim(adoRS!LAST_NAME)
Selection.TypeText " "
Selection.TypeParagraph
loop
It sounds, Jim, like you might need to be adjusting indentation on the
paragraphs instead of adjusting margins. You can't really change the margin
without its header and footer too (or not nearly as easily), so perhaps just
using indentation both left and right would help you.
************
Anne Troy
www.OfficeArticles.com
>I have a document that I open up and import data from a Sql Database. I
> perform this with VBA code. I make an adjustment to the margins that
> changes text entered into the document. It also changes the width of the
> headers and footers which is something that I dont want to happen. How
> do
> I keep that from happening with VBA code.
Jean-Guy Marcil - 27 Oct 2005 18:42 GMT
JimS was telling us:
JimS nous racontait que :
> I have a document that I open up and import data from a Sql Database.
> I perform this with VBA code. I make an adjustment to the margins
> that changes text entered into the document. It also changes the
> width of the headers and footers which is something that I dont want
> to happen. How do I keep that from happening with VBA code.
Why can't you adjust the margins and header/footer in the template manually?
Why do you have to do it with code?
Another solution is to put the header/footer stuff in a table with fixed
width or in a textbox that is has its position set to a value that is
relative to the edge of the page.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Charles Kenyon - 27 Oct 2005 20:14 GMT
Try changing the indents on the Header and Footer styles.

Signature
Charles Kenyon
Word New User FAQ & Web Directory: http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
>I have a document that I open up and import data from a Sql Database. I
> perform this with VBA code. I make an adjustment to the margins that
> changes text entered into the document. It also changes the width of the
> headers and footers which is something that I dont want to happen. How
> do
> I keep that from happening with VBA code.