ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write to Word Document from Excel VBA Help Needed (https://www.excelbanter.com/excel-programming/388166-write-word-document-excel-vba-help-needed.html)

JudyHNM

Write to Word Document from Excel VBA Help Needed
 
I have written the VBA to loop through a column on an Excel spreadsheet and
if the font description is "Script", I want to write the font name, the
alphabet (formatted in the font), and some other detail to a Word Document.
I have been able to create a new Word document, and I can save it and close
it from the Excel VBA, but I can NOT figure out how to write the information
described above to the Word document.

I know Excel VBA, but (obviously), I don't know Word VBA. I am using
version 2003 on Windows XP platform.

I would really appreaciate any help you could provide.

Thanks, Judy

Helmut Weber[_2_]

Write to Word Document from Excel VBA Help Needed
 
Hi Judy,

see:
http://word.mvps.org/faqs/interdev/c...wordfromxl.htm
http://word.mvps.org/faqs/interdev/E...ateBinding.htm

plus have a look at this one:

Private Sub Test0000()
Dim oWrd As Word.Application
Dim oDcm As Word.Document
Dim fntName As String

fntName = activecell.Font.Name

On Error Resume Next
Set oWrd = GetObject(, "Word.application")
If Err Then
Set oWrd = New Word.Application
End If
oWrd.Visible = True
Set oDcm = oWrd.Documents.Add
oDcm.Range.InsertBefore "abcdefghi" & Chr(13)
oDcm.Range.Paragraphs(1).Range.Font.Name = "Arial"
' ....... some more

End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

JudyHNM

Write to Word Document from Excel VBA Help Needed
 
Just what I needed to know -- thanks so much

"Helmut Weber" wrote:

Hi Judy,

see:
http://word.mvps.org/faqs/interdev/c...wordfromxl.htm
http://word.mvps.org/faqs/interdev/E...ateBinding.htm

plus have a look at this one:

Private Sub Test0000()
Dim oWrd As Word.Application
Dim oDcm As Word.Document
Dim fntName As String

fntName = activecell.Font.Name

On Error Resume Next
Set oWrd = GetObject(, "Word.application")
If Err Then
Set oWrd = New Word.Application
End If
oWrd.Visible = True
Set oDcm = oWrd.Documents.Add
oDcm.Range.InsertBefore "abcdefghi" & Chr(13)
oDcm.Range.Paragraphs(1).Range.Font.Name = "Arial"
' ....... some more

End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"



All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com