Connecting Tech Pros Worldwide Forums | Help | Site Map

How to set line indent in Word with VBA (Access)

Ronny Sigo
Guest
 
Posts: n/a
#1: Nov 12 '05
Hello all,
Could anybody give me the correct syntax to set the :
line indent,
top margin
cursor position
in Ms Word, with VBA ?
Thanks !!!
Ronny Sigo
....
Here's what I have done so far, everything work exept these 3 things ...
Dim appWD As Object
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
appWD.Documents.Add
With appWD
Set myDoc = .Documents.Add

With .Selection
.ParagraphFormat.LeftIndent = 0.95 ----- this does not
work
.PageSetup.TopMargin = InchesToPoints(0.95) ----- this
does not work
.ParagraphFormat.LeftIndent =
entimetersToPoints(0.95) ----- this does not work

.Font.Name = "Arial"
.Font.Size = 10
.......
.......
.MoveUp Unit:=wdLine.Count:=8 ----- this does not work
End With
myDoc.SaveAs FileName:="C:\Temp.doc"
End With




TC
Guest
 
Posts: n/a
#2: Nov 12 '05

re: How to set line indent in Word with VBA (Access)


Hey, thanks for responding to my suggestions on your other post!

TC


"Ronny Sigo" <ronny.sigo@skynet.be> wrote in message
news:3f66a078$0$1312$ba620e4c@reader2.news.skynet. be...[color=blue]
> Hello all,
> Could anybody give me the correct syntax to set the :
> line indent,
> top margin
> cursor position
> in Ms Word, with VBA ?
> Thanks !!!
> Ronny Sigo
> ...
> Here's what I have done so far, everything work exept these 3 things ...
> Dim appWD As Object
> Set appWD = CreateObject("Word.Application")
> appWD.Visible = True
> appWD.Documents.Add
> With appWD
> Set myDoc = .Documents.Add
>
> With .Selection
> .ParagraphFormat.LeftIndent = 0.95 ----- this does[/color]
not[color=blue]
> work
> .PageSetup.TopMargin = InchesToPoints(0.95) -----[/color]
this[color=blue]
> does not work
> .ParagraphFormat.LeftIndent =
> entimetersToPoints(0.95) ----- this does not work
>
> .Font.Name = "Arial"
> .Font.Size = 10
> .......
> .......
> .MoveUp Unit:=wdLine.Count:=8 ----- this does not work
> End With
> myDoc.SaveAs FileName:="C:\Temp.doc"
> End With
>
>
>[/color]


Ronny Sigo
Guest
 
Posts: n/a
#3: Nov 12 '05

re: How to set line indent in Word with VBA (Access)


Hello TC,
You're quit right, I do owe you an apology. I always respond to people who
try to help me. Only this time, life was a bit hectic (my 16 year old
doughter moving in with me, and me being on the first few days on a new job)
It is a small excuse and I hope you will accept it.
As for my problem, what astonishes me is that the whole thing works, only
those few commands which have to do with indents, page layout and cursor
movement don't ...
Do you know where I can find this Word VBA statements? or maybe you could
send me the right syntax ?
Greetz ...
Ronny
"TC" <a@b.c.d> wrote in message news:1063706198.861560@teuthos...[color=blue]
> Hey, thanks for responding to my suggestions on your other post!
>
> TC
>
>
> "Ronny Sigo" <ronny.sigo@skynet.be> wrote in message
> news:3f66a078$0$1312$ba620e4c@reader2.news.skynet. be...[color=green]
> > Hello all,
> > Could anybody give me the correct syntax to set the :
> > line indent,
> > top margin
> > cursor position
> > in Ms Word, with VBA ?
> > Thanks !!!
> > Ronny Sigo
> > ...
> > Here's what I have done so far, everything work exept these 3 things ...
> > Dim appWD As Object
> > Set appWD = CreateObject("Word.Application")
> > appWD.Visible = True
> > appWD.Documents.Add
> > With appWD
> > Set myDoc = .Documents.Add
> >
> > With .Selection
> > .ParagraphFormat.LeftIndent = 0.95 ----- this does[/color]
> not[color=green]
> > work
> > .PageSetup.TopMargin = InchesToPoints(0.95) -----[/color]
> this[color=green]
> > does not work
> > .ParagraphFormat.LeftIndent =
> > entimetersToPoints(0.95) ----- this does not work
> >
> > .Font.Name = "Arial"
> > .Font.Size = 10
> > .......
> > .......
> > .MoveUp Unit:=wdLine.Count:=8 ----- this does not[/color][/color]
work[color=blue][color=green]
> > End With
> > myDoc.SaveAs FileName:="C:\Temp.doc"
> > End With
> >
> >
> >[/color]
>
>[/color]


TC
Guest
 
Posts: n/a
#4: Nov 12 '05

re: How to set line indent in Word with VBA (Access)


Hi Ronny

No problems :-)

You can get online help for Word VBA, something like this: (I don't have
Word here to check the exact details): select Tools : Macro, select the
option that goes to the VBA editor, then click Help : Contents. That is, the
normal Help options give you VBA help (instead of normal Word help), when
you are in a "programming" context such as the VBA editor.

Another way I sometimes use, is to locate the corresponding HLP file (I
think from memory it's VBAWRD.HLP), and define a desktop shortcut to that
file. Then I can just double-click that shortcut, at any time, from any
context, to display that help.

A good source of extra information is the microsoft.public.word.*
newsgroups. You will get much more help on Word VBA there, compared to here.
You are working in an Access context, but you are really using Word VBA.

Another phenomenal source of information, is google groups. Go to
groups.google.com, select Advanced Search, type *word* into the Newsgroups
box, and leftindent into the "all words" box, and press return. Voila: 366
threads pertaining to Word leftindent!

Hope this all helps,
TC


"Ronny Sigo" <ronny.sigo@skynet.be> wrote in message
news:3f6746bc$0$31740$ba620e4c@reader1.news.skynet .be...[color=blue]
> Hello TC,
> You're quit right, I do owe you an apology. I always respond to people who
> try to help me. Only this time, life was a bit hectic (my 16 year old
> doughter moving in with me, and me being on the first few days on a new[/color]
job)[color=blue]
> It is a small excuse and I hope you will accept it.
> As for my problem, what astonishes me is that the whole thing works, only
> those few commands which have to do with indents, page layout and cursor
> movement don't ...
> Do you know where I can find this Word VBA statements? or maybe you could
> send me the right syntax ?
> Greetz ...
> Ronny
> "TC" <a@b.c.d> wrote in message news:1063706198.861560@teuthos...[color=green]
> > Hey, thanks for responding to my suggestions on your other post!
> >
> > TC
> >
> >
> > "Ronny Sigo" <ronny.sigo@skynet.be> wrote in message
> > news:3f66a078$0$1312$ba620e4c@reader2.news.skynet. be...[color=darkred]
> > > Hello all,
> > > Could anybody give me the correct syntax to set the :
> > > line indent,
> > > top margin
> > > cursor position
> > > in Ms Word, with VBA ?
> > > Thanks !!!
> > > Ronny Sigo
> > > ...
> > > Here's what I have done so far, everything work exept these 3 things[/color][/color][/color]
....[color=blue][color=green][color=darkred]
> > > Dim appWD As Object
> > > Set appWD = CreateObject("Word.Application")
> > > appWD.Visible = True
> > > appWD.Documents.Add
> > > With appWD
> > > Set myDoc = .Documents.Add
> > >
> > > With .Selection
> > > .ParagraphFormat.LeftIndent = 0.95 ----- this[/color][/color][/color]
does[color=blue][color=green]
> > not[color=darkred]
> > > work
> > > .PageSetup.TopMargin = InchesToPoints(0.95) -----[/color]
> > this[color=darkred]
> > > does not work
> > > .ParagraphFormat.LeftIndent =
> > > entimetersToPoints(0.95) ----- this does not work
> > >
> > > .Font.Name = "Arial"
> > > .Font.Size = 10
> > > .......
> > > .......
> > > .MoveUp Unit:=wdLine.Count:=8 ----- this does not[/color][/color]
> work[color=green][color=darkred]
> > > End With
> > > myDoc.SaveAs FileName:="C:\Temp.doc"
> > > End With
> > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


Closed Thread


Similar Microsoft Access / VBA bytes