Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I want to take what I have in my worksheet and be able to export all of that
into a fomratted word file. I don't want to cut and paste. Is there a way to export it to a word or html file. I want to program a button that says "click here to generate report" then the reader will get a file that opens up in Word or HTML. Any help is appreciated Thanks. ee |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
This uses early binding, so you need to set a reference the the
Microsoft Word x.x Object Library. I can throw together a late binded version if that is what you would prefer. Sub CopyWorksheetToWord() Dim wdApp As Word.Application Dim wdDoc As Word.Document Dim ws As Worksheet Application.ScreenUpdating = False Set wdApp = New Word.Application Set wdDoc = wdApp.Documents.Add 'edit to the range you want to copy Set ws = ActiveSheet ws.UsedRange.Copy wdDoc.Paragraphs(wdDoc.Paragraphs.Count) _ .Range.InsertParagraphAfter wdDoc.Paragraphs(wdDoc.Paragraphs.Count) _ .Range.Paste Application.CutCopyMode = False wdDoc.Paragraphs(wdDoc.Paragraphs.Count) _ .Range.InsertParagraphAfter wdDoc.Content.InsertAfter ws.Name Set ws = Nothing With wdApp.ActiveWindow If .View.SplitSpecial = wdPaneNone Then .ActivePane.View.Type = wdNormalView Else .View.Type = wdNormalView End If End With Set wdDoc = Nothing wdApp.Visible = True Set wdApp = Nothing End Sub Enrique wrote: I want to take what I have in my worksheet and be able to export all of that into a fomratted word file. I don't want to cut and paste. Is there a way to export it to a word or html file. I want to program a button that says "click here to generate report" then the reader will get a file that opens up in Word or HTML. Any help is appreciated Thanks. ee |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
convert excel document to word document (not a picture) | Excel Discussion (Misc queries) | |||
How can I convert a WORD document to EXCEL? | Excel Discussion (Misc queries) | |||
How do I convert a word document into a Excel document | Excel Discussion (Misc queries) | |||
How do I convert Word document into an Excel document? | Excel Discussion (Misc queries) | |||
how do i convert a word document to excel | Excel Discussion (Misc queries) |