#1
|
|||
|
|||
How to transfer multiple cells from excel to word by formulas
Hello Im wondering how would I transfer 1 part of cell with text, from Excel, to specific spot in Word document, by just showing the destination with formula in Word file. For fast swaping text in word files after i write new texts in excel. Thank you! |
#2
|
||||
|
||||
Can you give an example of the rules that need to be followed to allow this to work?
ie:
|
#3
|
|||
|
|||
Quote:
i know how to crate excel link. but when i create new row in excel file. i wanna warn the word that it should look 1 row lower where i can put new informations for difretn project. |
#4
|
||||
|
||||
Quote:
I know the numbers on your picture are not steps - but WHAT ARE THE STEPS! I can't help and write code if you don't have rules for the data to be handled - you pictures are no help, because I have no idea what the data shown is, nor what you want it to do - how then am I to help??? What I'm trying to point out is that your original post is not clear enough in the details for me to be able to understand what you want - I'm asking that you clarify it for me so that I can see if I can help. Please see my previous post, and try to use a similar format to state the rules that you are trying to follow - If you can provide that information, I can maybe try to help you - without that information, I don't see how I can, sorry! Let me give you an example of what I mean: From the images you posted I will use the example of (1) - I can see that you want the last part of Cell A to be moved across to the Word document. I can do that because I can see it. But, how am I to tell Word and Excel to recognise that? Cell A145 = Igerc - [Ravne na Koroskem-Center Ravne] - You want to see ONLY [Center Ravne] moved to the Word document. Cell A148 = [HOTEL DIANA 100kg] - What, if anything, is going to move from this cell? - How am I supposed to know that? How is EXCEL supposed to know that? So by what rules do you want to move [Center Ravne], but NOT [HOTEL DIANA 100kg]? OR do you WANT to move [HOTEL DIANA 100kg]? Is there something that shows excel that the cell contains valid text for the move (a special character, for example)? Or maybe you only want cells with [Center Ravne] to be included in the move, and so all the rest can be ignored! Please remember that none of us here has any idea what this data relates to, nor how it is all supposed to work! You MUST be clear and detailed in your wants and needs if you want us to be able to understand and respond! I hope this helps clarify things, and that you can now clarify things for us! Last edited by Bird_FAT; 05-19-2009 at 11:53 AM. Reason: added an example! |
#5
|
|||
|
|||
|
#6
|
||||
|
||||
OK - Here goes,
I'm hoping that I have understood you this time, and that this is what you want - if not, then you will have a little tweaking to do! The following code should do the following when run:
EXCEL:
Code:
Option Explicit Sub ExportFinalColumnToWord() On Error GoTo errorHandler Dim wdApp As Word.Application Dim myDoc As Word.Document Dim mywdRange As Word.Range Dim MyColumnA As Excel.Range Dim MyColumnB As Excel.Range Dim MyColumnC As Excel.Range Dim MyColumnE As Excel.Range On Error Resume Next Set wdApp = GetObject(, "Word.Application") If Err.Number <> 0 Then Set wdApp = CreateObject("Word.Application") End If On Error GoTo 0 ' You need to change the path details here - ' This will create a new document based on your original. Set myDoc = wdApp.Documents.Add(Template:="C:\Tempo\ExWd.doc") ' Here you need to change the following: ' MySheet - this is the tab name of the sheet in the spreadsheet ' A1,B1,C1,E1 - these are the columns where the data is found Set MyColumnA = Sheets("MySheet").Range("A1").End(xlDown) Set MyColumnB = Sheets("MySheet").Range("B1").End(xlDown) Set MyColumnC = Sheets("MySheet").Range("C1").End(xlDown) Set MyColumnE = Sheets("MySheet").Range("E1").End(xlDown) ' This is where you get the information pasted into your document. ' Below there are four references to bookmarks - inside the (""). ' You will need to change the names to those of YOUR bookmarks. ' If you want data entered into more than one place, you need to ' create a new line, as below, and change the bookmark name, ' choosing the correct reference at the end 'MyColumnX' ' For example to have the information from Column A in another place, ' you would add the line in green that is below this section. With myDoc.Bookmarks .Item("bmMyColumnA").Range.InsertAfter MyColumnA .Item("bmMyColumnB").Range.InsertAfter MyColumnB .Item("bmMyColumnC").Range.InsertAfter MyColumnC .Item("bmMyColumnE").Range.InsertAfter MyColumnE ' .Item("bmMyColumnA_2").Range.InsertAfter MyColumnA End With ' At this point the Word Application will appear in your taskbar wdApp.Visible = True Exit Sub errorHandler: wdApp.Quit Set wdApp = Nothing Set myDoc = Nothing Set mywdRange = Nothing End Sub Hope that does the job! Last edited by Bird_FAT; 05-23-2009 at 07:01 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shading in Cells in Word Tables | Cindy | Word Tables | 1 | 01-04-2013 02:38 PM |
Opening multiple Excel files within the same Excel window. | lost9471 | Excel | 2 | 05-01-2010 01:57 PM |
Word 2007 Password not staying after file transfer. | grumalt | Word | 1 | 04-17-2009 12:30 PM |
Populate cells in Word from a database | hotlilshan | Word | 3 | 12-09-2008 01:51 PM |
Automatically entering/fill data in cells in Excel 2003 | dipdog | Excel | 0 | 08-17-2006 08:37 AM |