Author | Topic: Word: Copy and Paste | |
---|---|---|
Domingo Serrano | Word: Copy and Paste on Mon, 19 Dec 2016 02:12:01 +0100 Hello, I only need: - "Document1.Doc" : Select and Copy. - "Document2.Doc" : Paste (in the end of the document). Thanks in advance, Domingo Jareno. | |
Jim Lee | Re: Copy and Paste on Mon, 19 Dec 2016 02:39:39 +0100 > I only need: > - "Document1.Doc" : Select and Copy. > - "Document2.Doc" : Paste (in the end of the document). start Word start record Macro load doc1 / Select and Copy. load doc2 / Paste stop record Macro upload Macro and show us what your have recorded than we can help to translate into Xbase++ | |
Domingo Serrano | Re: Copy and Paste on Mon, 19 Dec 2016 03:10:23 +0100 Jim Lee wrote in message news:6d751ff2$e973940$1b19c5@news.alaska-software.com... >> I only need: >> - "Document1.Doc" : Select and Copy. >> - "Document2.Doc" : Paste (in the end of the document). > >start Word >start record Macro >load doc1 / Select and Copy. >load doc2 / Paste >stop record Macro > >upload Macro and show us what your have recorded than we can help to >translate into Xbase++ Thank you, Jim. Macro result is: Selection.WholeStory Selection.Copy Selection.PasteAndFormat (wdPasteDefault) How can I translate into Xbase++? | |
Jim Lee | Re: Copy and Paste on Tue, 20 Dec 2016 06:15:10 +0100 hi, is this the hole Macro ? do not expect "ready to use" Code .. i'm not a VBA Programmer have you try Alaska ..\SOURCE\samples\activex\msword\*.PRG Sample ? it show how to start with Word ActiveX --- #include "activex.ch" #PRAGMA LIBRARY( "ASCOM10.LIB" ) PROCEDURE MAIN LOCAL oWord LOCAL oDoc1,oDoc2 LOCAL cFile1 := "D:\ALASKA\BLABLA\TEST1.DOC" LOCAL cFile2 := "D:\ALASKA\BLABLA\TEST2.DOC" oWord := CreateObject("Word.Application") IF Empty( oWord ) MsgBox( "Microsoft Word is not installed" ) QUIT ENDIF oWord:visible := .T. oWord:documents:open( cFile1 ) oDoc1 := oWord:ActiveDocument --- if you do not understand last 3 lines you have to read about Word Object Reference Model in Help File. since Office 12 (2009) *.CHM Help files are not include local ( Zero Byte ) any more -> need online i recommend to download old Word 2003 Help file from https://www.microsoft.com/en-us/download/details.aspx?id=15312 btw. Constante like wdPasteDefault can be created by ..\XPPW32\BIN\Tlb2Ch.exe Tlb2Ch.exe "Word.Application" >> MyWord.CH as i say i'm not a VBA Programmer so next is to search on Internet for Sample which include "WholeStory Copy PasteAndFormat" and found something like this http://vba.relief.jp/word-vba-select-all-text-by-wholestory/ http://stackoverflow.com/questions/26463942/copy-and-pasting-from-multiple-word-documents-vba i try to write some (untested) Dummy Code --- /******************************************** here your Code mySelection := oDoc1:Range:Select ??? * mySelection:WholeStory * mySelection:Copy or oDoc1:Range:Copy ??? * ********************************************/ oWord:documents:open( cFile2 ) oDoc2 := oWord:ActiveDocument /******************************************** mySelection := oDoc2:Range:Select ??? * mySelection:PasteAndFormat or * oDoc2:Range:Paste ??? * ********************************************/ oDoc2:close() oDoc1:close() oWord:Quit() oWord:destroy() RETURN NIL --- it is your work to find out how the hole Story goes ... have fun | |
Domingo Serrano | Re: Copy and Paste on Tue, 20 Dec 2016 13:14:25 +0100 Thank you, Jim. But my problem is not solved. Jim Lee wrote in message news:2acb0014$459a9226$21e4a1@news.alaska-software.com... >hi, > >is this the hole Macro ? > >do not expect "ready to use" Code .. i'm not a VBA Programmer > >have you try Alaska ..\SOURCE\samples\activex\msword\*.PRG Sample ? >it show how to start with Word ActiveX > >--- >#include "activex.ch" >#PRAGMA LIBRARY( "ASCOM10.LIB" ) > >PROCEDURE MAIN >LOCAL oWord >LOCAL oDoc1,oDoc2 >LOCAL cFile1 := "D:\ALASKA\BLABLA\TEST1.DOC" >LOCAL cFile2 := "D:\ALASKA\BLABLA\TEST2.DOC" > > oWord := CreateObject("Word.Application") > IF Empty( oWord ) > MsgBox( "Microsoft Word is not installed" ) > QUIT > ENDIF > > oWord:visible := .T. > oWord:documents:open( cFile1 ) > oDoc1 := oWord:ActiveDocument >--- > >if you do not understand last 3 lines you have to read about Word Object >Reference Model in Help File. >since Office 12 (2009) *.CHM Help files are not include local ( Zero Byte ) >any more -> need online > >i recommend to download old Word 2003 Help file from >https://www.microsoft.com/en-us/download/details.aspx?id=15312 > >btw. > >Constante like wdPasteDefault can be created by ..\XPPW32\BIN\Tlb2Ch.exe > >Tlb2Ch.exe "Word.Application" >> MyWord.CH > >as i say i'm not a VBA Programmer so next is to search on Internet for >Sample >which include "WholeStory Copy PasteAndFormat" and found something like this > >http://vba.relief.jp/word-vba-select-all-text-by-wholestory/ >http://stackoverflow.com/questions/26463942/copy-and-pasting-from-multiple-word-documents-vba > >i try to write some (untested) Dummy Code >--- > >/******************************************** >* >* here your Code >* >* mySelection := oDoc1:Range:Select ??? >* mySelection:WholeStory >* mySelection:Copy >* >* or >* >* oDoc1:Range:Copy ??? >* >********************************************/ > > oWord:documents:open( cFile2 ) > oDoc2 := oWord:ActiveDocument > >/******************************************** >* >* mySelection := oDoc2:Range:Select ??? >* mySelection:PasteAndFormat >* >* >* or >* >* oDoc2:Range:Paste ??? >* >********************************************/ > > oDoc2:close() > oDoc1:close() > oWord:Quit() > oWord:destroy() >RETURN NIL > >--- > >it is your work to find out how the hole Story goes ... have fun | |
Domingo Serrano | notifications on Tue, 20 Dec 2016 01:30:24 +0100 |