Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default can i convert my excel tab into a word document?

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 638
Default can i convert my excel tab into a word document?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert excel document to word document (not a picture) frendabrenda1 Excel Discussion (Misc queries) 2 October 6th 06 03:55 PM
How can I convert a WORD document to EXCEL? Robert Judge Excel Discussion (Misc queries) 3 April 20th 06 11:16 PM
How do I convert a word document into a Excel document gwiltz2 Excel Discussion (Misc queries) 1 October 22nd 05 07:04 PM
How do I convert Word document into an Excel document? Jamie Excel Discussion (Misc queries) 3 April 7th 05 09:45 PM
how do i convert a word document to excel Ian Excel Discussion (Misc queries) 2 December 13th 04 12:54 PM


All times are GMT +1. The time now is 11:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"