Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro

Hi, there.

I really need this.
I need an excel macro copies multiple worksheets from a workbook. (A
workbook contains multiple worksheets), and paste onto a word
document.)
Please help me..I am so new at this excel macro, and have no idea to
start out.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro

I've found this code from microsoft.com. But it doesn't fit my needs
quite well.
I need it modified as macro finds active sheet and active cells from
each sheet.
This code copies from fixed location.

And I believe this code used if statement to check the system is PC or
MAC, but I will run this only on PC...need to get rid of that "if"
statement.

__________________________________________________ ____________________

Sub PasteTableToWord()
Dim obj As Word.Application

Worksheets("sheet1").Activate 'Activate the worksheet
'Select the range of cells to copy
Worksheets("sheet1").Range("a1:c10").Copy

Set obj = CreateObject("Word.Application.9") 'Create a word object
obj.Visible = True 'Make Word visible
Set newDoc = obj.Documents.Add 'Create a new file.

'Determine if Microsoft Excel is running on the Macintosh or
Windows.
If (Application.OperatingSystem Like "*Mac*") Then
AppActivate "Microsoft word"
obj.Selection.PasteSpecial 'Paste data into Word

Else 'If Windows NT/95/3.x - paste data into Word
obj.Selection.PasteSpecial
End If
'Format table
obj.Selection.Tables(1).AutoFormat Format:=wdTableFormatGrid1
newDoc.SaveAs Filename:="C:\TestDoc.doc" 'Save the file
obj.Quit 'Quit Word
Set obj = Nothing 'Release object
End Sub

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
Copy & paste macro for multiple worksheets tomhelle Excel Discussion (Misc queries) 8 March 15th 10 06:21 PM
how to copy a cell in excell and paste in a txt file with macro Krishna_AJ Excel Discussion (Misc queries) 0 June 21st 07 09:51 PM
On a DDE Linked worksheet : Copy and Paste Value to a to a file via a macro ? Martin Links and Linking in Excel 0 November 20th 06 11:19 AM
create multiple worksheets in workbook from one csv file Lost in Windows Excel Discussion (Misc queries) 1 July 24th 05 02:42 AM
Select File Copy/Paste Macro Help.... Jay Baker Excel Programming 1 January 14th 04 01:01 PM


All times are GMT +1. The time now is 01:43 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"