Generating a word document from Excel 
Author Message
 Generating a word document from Excel

I have a currency value in a cell in an Excel worksheet.

I need a macro to generate a word document which will then insert this value
in a particular place within a standard text.

Any ideas?

Many thanks

paddymichelle



Sun, 16 Mar 2003 03:00:00 GMT  
 Generating a word document from Excel

Hi Michelle,
the following code may be useful for you. The sub first opens word, then add a new document, set format of text and finally insert in document the content of cell A1 of the active excel worksheet.
All code lines that begin with "wd" use word VBA commands.

    Sub WordDoc()
    Dim wd As Object

        Set wd = CreateObject("Word.Application")
        wd.Visible = True
        wd.Documents.Add
        wd.Selection.Font.Bold = True
        wd.Selection.Font.Italic = True
        wd.Selection.Font.Size = 14
        wd.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
        wd.Selection.TypeText Text:=Range("A1").Text

    End Sub

Hope this helps.

Sergio

--

Please post any follow question in the newsgroup.
Remove 'NOSPAM' to reply by e-mail.


Quote:
> I have a currency value in a cell in an Excel worksheet.

> I need a macro to generate a word document which will then insert this value
> in a particular place within a standard text.

> Any ideas?

> Many thanks

> paddymichelle



Mon, 17 Mar 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Generating word document files from embedded documents in Access or SQL Server DB.

2. generating WORD documents

3. Using VB.Net to Generate MS Word Documents

4. Can you make ASP generate a Word Document?

5. Automatic Generate a word-document from VB

6. Automatic Generate a word-document from VB

7. Automatic Generate a word-document from VB

8. Automatic Generate a word-document from VB

9. Automatic Generate a word-document from VB

10. Automatic Generate a word-document from VB

11. Automatic Generate a word-document from VB

12. Cutting a full Word document and pasting it in another Word Document

 

 
Powered by phpBB® Forum Software