Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Copy a worksheet or table from an Excel workbook to Word Doc

$
0
0
Hi Friends,

I want to copy a table on an Excel worksheet to a MS Word document.  A copy and  paste method worked when I tried it manually.

Can we directly pass a word document object to the excel copy method? Please suggest me some way to copy an excel worksheet table to a word document.

Func _TableCopy($sExcelFile, $sWordDocument)
 
 $oExcel = ObjCreate("Excel.Application") ;create Excel object
 $oWordApp = _WordCreate ($sWordDocument, 0, 0)
 $oDocuments = _WordDocGetCollection ($oWordApp,1)
 $oExcel.WorkBooks.Open($sExcelFile) ;Open input file
 $oExcel.Application.ActiveWorkbook.Sheets($aSheetNames[1]).Copy()
 
 
 $oExcel.Quit ;Quit Excel
 
EndFunc ;=>_TableCopy


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>