Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default copy excel to word

Hi, everybody:

I never did this before and I need your expertise. I would like to
create a macro button in excel such that whenever I click this button,
3 columns (A, B, and C) with unknown rows under excel sheet1 will be
copied and pasted as Unformatted Text into an automatically created
word document. Three requirements:
1) The automatically created word document will have a left and
right margin of 0.6";
2) Any rows with something in column A in Excel will be shown as
Bold Text in the word documet after copy and copy;
3) The first line of the word document will be center aligned.
Anything else will be justified.

I appreciate any of your help. You all have a nice 4th of July.

Jorge

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default copy excel to word

This site should get you started.

http://www.exceltip.com/st/Copy_work...Excel/481.html

" wrote:

Hi, everybody:

I never did this before and I need your expertise. I would like to
create a macro button in excel such that whenever I click this button,
3 columns (A, B, and C) with unknown rows under excel sheet1 will be
copied and pasted as Unformatted Text into an automatically created
word document. Three requirements:
1) The automatically created word document will have a left and
right margin of 0.6";
2) Any rows with something in column A in Excel will be shown as
Bold Text in the word documet after copy and copy;
3) The first line of the word document will be center aligned.
Anything else will be justified.

I appreciate any of your help. You all have a nice 4th of July.

Jorge


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default copy excel to word

Hi, John and JL:

I tried what you said but still no luck. Any other ideas?

Thanks,

Jorge

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default copy excel to word

Hi, Jorge:

Interesting. Someboy (not me) will help you out!

Thanks,




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default copy excel to word

Hi, Jorge:

Since I did not see many MVP level expertises showing up today, I did
a search and find something from our previous post + my own pratice.
Due to my shortage of knowledge, the following code is only for your
reference (copy 3 columns from excel and paste special as unformatted
text into word) as it doesn't solve your problem. You will need to
make a word template with left and right margins of 0.6" and save it
under C:\ drive. You will also need to make a bookmark to specify
where you want to paste in this word template. I really wish many
people will get into this as this is really common in reality. Correct
me if I did anything wrong. Thanks,

Sub Test()

Const wdGoToBookmark = -1
Const wdSaveChanges = -1
Dim ws As Worksheet
Dim i As Integer
Dim WdApp As Object
Dim strFile As String
Dim doc As Object

'I assume column C has the most rows among A, B, and C
Set Rng = Sheets("Sheet1").Range(Cells(1, "A"), Cells(Rows.Count,
"C").End(xlUp))

Rng.Select
Selection.Copy

strFile = "C:\CopyExcelToWord.doc"
On Error Resume Next
Set WdApp = GetObject(, "Word.Application")
If Err.Number < 0 Then
Err.Clear
Set WdApp = CreateObject("Word.Application")
End If


WdApp.Documents.Open Filename:=strFile, ConfirmConversions:=False,
ReadOnly:=False
Set doc = WdApp.activedocument
WdApp.Visible = True

With WdApp
.Selection.GoTo What:=wdGoToBookmark, Name:="bkmk"
.Selection.PasteSpecial Link:=False, DataType:=wdPasteText,
Placement:=wdInLine, DisplayAsIcon:=False
End With

Set WdApp = Nothing

End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default copy excel to word

What happend when you recorded yourself doing it? What shoed up in the
macro?

John


wrote:

Hi, John and JL:

I tried what you said but still no luck. Any other ideas?

Thanks,

Jorge

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default copy excel to word

Hi, George:

I just had a chance to be online. Thanks for all the work you did. I
will try what you wrote here. Thanks again!

Jorge

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default copy excel to word

Hi, George:

I tried but not sure what's the meaning of
Const wdGoToBookmark = -1 and
Set WdApp = Nothing

Also, how to make a bookmark?

Thanks,

Jorge

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 Chart from Excel to Word using VBA Jonathan Allen Excel Programming 6 March 8th 09 02:02 AM
Copy from Word to Excel Miffed Excel Worksheet Functions 2 August 17th 07 04:22 PM
Macro to find a word and copy all rows with this word to diff ws Chas Excel Programming 3 April 27th 07 11:16 PM
Copy from Word to Excel, and retain indent, plus word wrap Eric Excel Discussion (Misc queries) 1 March 9th 07 03:15 AM
search for a specific word and copy the word and the preceeding words until a comma DHANANJAY Excel Programming 12 December 31st 05 12:53 PM


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

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"