Adaytay
01-06-2006, 02:31 AM
Hey all, happy new year!
I'm currently in the middle of coding up a Word Document that gets controlled from word. This word doc is actually an invoice Cover Letter (the invoice is generated seperately).
Part of the word document contains a list of documents that accompany the invoice, this is collated from within Access and copied across into the word document at a specific bookmark.
Access then uses the following code (note this is not the entire procedure) to select the list and then convert it to a bulleted list. Trouble is, the code worked the first time I ran it but it won't work again?? Oh, I should add that this code is what the Word Macro recorded, modified to run from Access.
'Add in the types of documentation that we have now...
.Bookmarks("IncludedDocs").Select
objWord.Selection.TypeText strDocuments 'strDocuments gets set in BuildCostsTable so we can use this!
'That's the text in, now select the inserted text, and convert to bullet points
.Bookmarks("IncludedDocs").Select
objWord.Selection.MoveDown Unit:=wdLine, Count:=intCount, Extend:=wdExtend
With objWord.ListGalleries(wdBulletGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = ChrW(61623)
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleBullet
.NumberPosition = CentimetersToPoints(0.63)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(1.27)
.TabPosition = CentimetersToPoints(1.27)
.ResetOnHigher = 0
.StartAt = 1
With .Font
.Color = wdColorRed
.Name = "Symbol"
End With
.LinkedStyle = ""
End With
objWord.ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
objWord.Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries( _
wdBulletGallery).ListTemplates(1), ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior
Any ideas?
Thanks,
Ad
I'm currently in the middle of coding up a Word Document that gets controlled from word. This word doc is actually an invoice Cover Letter (the invoice is generated seperately).
Part of the word document contains a list of documents that accompany the invoice, this is collated from within Access and copied across into the word document at a specific bookmark.
Access then uses the following code (note this is not the entire procedure) to select the list and then convert it to a bulleted list. Trouble is, the code worked the first time I ran it but it won't work again?? Oh, I should add that this code is what the Word Macro recorded, modified to run from Access.
'Add in the types of documentation that we have now...
.Bookmarks("IncludedDocs").Select
objWord.Selection.TypeText strDocuments 'strDocuments gets set in BuildCostsTable so we can use this!
'That's the text in, now select the inserted text, and convert to bullet points
.Bookmarks("IncludedDocs").Select
objWord.Selection.MoveDown Unit:=wdLine, Count:=intCount, Extend:=wdExtend
With objWord.ListGalleries(wdBulletGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = ChrW(61623)
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleBullet
.NumberPosition = CentimetersToPoints(0.63)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(1.27)
.TabPosition = CentimetersToPoints(1.27)
.ResetOnHigher = 0
.StartAt = 1
With .Font
.Color = wdColorRed
.Name = "Symbol"
End With
.LinkedStyle = ""
End With
objWord.ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
objWord.Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries( _
wdBulletGallery).ListTemplates(1), ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior
Any ideas?
Thanks,
Ad