Solved

stuff text into MS Word from VB

Posted on 2002-05-02
2
121 Views
Last Modified: 2010-08-05
I'm reasonably conversant w/ VB and VBA but I can't figure out how to do what I believe should be a simple operation which is to take a bunch of text (call it a long string) and stuff it into MS Word (opening an instantiation of Word as part of the process). I can worry about formatting & stuff later, if someone can just push on my chest to get me breathing.

Thanks for your time.
0
Comment
Question by:HobbitHouse
2 Comments
 
LVL 3

Accepted Solution

by:
nzjonboy earned 50 total points
ID: 6987195
check out this basic tutorial

http://www.vbsquare.com/beginning/begword/

nzjonboy
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6987285
reference microsoft word object library:

Dim wdApp As New Word.Application
Dim wdDoc As Word.Document

Set wdDoc = wdApp.Documents.Add
wdDoc.Content.InsertBefore "WRITE THIS TO THE NEW DOCUMENT"
wdDoc.SaveAs "C:\windows\desktop\testDoc.doc"

wdDoc.Close
Set wdDoc = Nothing
wdApp.Quit
Set wdApp = Nothing
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now