Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I want to run a macro from excell that copys sections of different word documents into a new one. I would build each doc like this: [DUTCH] Dit is de Nederlandse tekst voor een LOOPGANG [END] [GERMAN] Das ist der Deutsche tekst für ein LAUFSTEG [END] [ENGLISH] This is the English text for a WALKWAY [END] [FRENCH] Voici le texte francais pour une PASSERELLE [END] Depending on the language selected in excel I would like the section corresponding with it to be copied into a new doc. Eg. if the language is set to english I wan the text [ENGLISH] and the next [END] being "This is the English text for a WALKWAY" to be copy into a new doc. I already got the code to copy entire docs but i would like to alter it to perform the actions as described above. Sub MergeWordDocs() Dim wrdApp As Object, strFile As String Dim wrdDoc As Object, wrdNew As Object Set wrdApp = CreateObject("Word.Application") Set wrdNew = wrdApp.Documents.Add strFiles = "c:\1.doc,c:\2.doc,c:\Quick Response SLA.doc" For intTemp = 0 To UBound(Split(strFiles, ",")) Set wrdDoc = wrdApp.Documents.Open(Split(strFiles, _ ",")(intTemp), ReadOnly:=True) wrdDoc.Range.Copy Set myRange = wrdNew.Range(wrdNew.Content.End - 1, _ wrdNew.Content.End - 1) myRange.Paste wrdDoc.Close False: Set wrdDoc = Nothing Next wrdNew.SaveAs "c:\merge1.doc": wrdNew.Close True wrdApp.Quit: Set wrdApp = Nothing End Sub Thanks, Lieven |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trying to pull data from multiple sheets (and Word docs too) | Excel Discussion (Misc queries) | |||
Import cells from excel into word and create multiple word docs | Excel Programming | |||
Code in Excel macro to get all open Word docs? | Excel Programming | |||
Embedding Word Docs into Excel Worksheets and Then Printing The Word Docs | Excel Worksheet Functions | |||
converting excel docs to word docs | New Users to Excel |