Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Access textbox contents to Word via VBScript

Reply
 
Old 05-04-2009   #1 (permalink)
andreaandcarl


 
 

Access textbox contents to Word via VBScript

I have a form in Access 2003 with a few textboxes that are filled with
user entered text and some from queries and a command button to
execute the write to Word.

I would like to write the contents of these textboxes to a Word (2003)
document.

Here is the code that I have thus far:

Dim objWord As Object

Set objWord = CreateObject("Word.Application")
objWord.Visible = True 'only set to true so that I can see that
something is happening
objWord.Caption = "Tender Letter Writting Wizard"

Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection 'not sure why this is here
apart from finding it in a code snippet

'define the document text style
objSelection.Font.Name = "Times New Roman"
objSelection.Font.Size = "12"

objWord.Activate
objSelection.TypeText "this is user entered text"
objSelection.TypeParagraph

objSelection.TypeText "test message"

objDoc.SaveAs ("d:\test.doc")
'objWord.Quit

'release object allocations as good practice
Set objWord = Nothing
Set objDoc = Nothing
Set objSelection = Nothing

I must say that I am pushing the llmits of my simplistic knowledge of
Access.

Any assistance would be greatly appreciated. Any links to similar
examples and info site about how to do this would be appreciated also.

Kind regards,
Carl

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can vbscript capture Word.Application events ? VB Script
[MS Word Macro] VBscript flag image to not print it VB Script
Textbox scroll bar in access .NET General
Vista won't find a file given a word in the contents Vista file management
Access folder contents Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46