By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,773 Members | 2,583 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,773 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
TC
Hey, thanks for responding to my suggestions on your other post!

TC
"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f**********************@reader2.news.skynet. be...
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

Nov 12 '05 #2

P: n/a
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...
Hey, thanks for responding to my suggestions on your other post!

TC
"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f**********************@reader2.news.skynet. be...
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


Nov 12 '05 #3

P: n/a
TC
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" <ro********@skynet.be> wrote in message
news:3f***********************@reader1.news.skynet .be...
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...
Hey, thanks for responding to my suggestions on your other post!

TC
"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f**********************@reader2.news.skynet. be...
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



Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.