View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
daniB[_6_] daniB[_6_] is offline
external usenet poster
 
Posts: 1
Default Getting a range from Excel into a Word document

Hello All,

I am trying to get a named range into a word document.....I have thi
code....

It creates a word document correctly with the right path however, ho
do i get the named range into the word document??

Any Ideas??

Thanks - Dani

Sub MakeWordFile()
' Creates Word document
Dim WordApp As Object

On Error Resume Next
Application.ScreenUpdating = False

' Start Word and create an object
Set WordApp = CreateObject("Word.Application")
With WordApp
.Documents.Add
End With

' Determine the file name
SaveAsName = ThisWorkbook.Path & "\" & "volumeslast2weeks.doc"

' Select worksheet
Sheets("NETWORKS").Select




' Information from worksheet
Set Data = Sheets("Networks").Range("Changes")






' Send commands to Word
With WordApp
With .Selection
'?????SOMETHING TO GO HERE TO IMPUT THE DATA IN RANG
"Changes" or Variable Set Data????

End With
End With

' Save the Word file and close it
With WordApp
.ActiveDocument.SaveAs Filename:=SaveAsName
.ActiveWindow.Close
' Kill the object
.Quit
End With

Set WordApp = Nothing

' Reset status bar
Application.StatusBar = ""
MsgBox "Completed and saved " & ThisWorkbook.Path
End Su

--
Message posted from http://www.ExcelForum.com