Hello,
Maybe a strange question but I'm looking in FWH for a way to import an excel-file into a Word-document.
Anyone any idea?
Thanks a lot in advance.
oExcel := CREATEOBJECT( "Excel.Application" )
oExcel:WorkBooks:Open( "C:\Where_is_the_file\Name_of_the_file" )
nI := which sheet I want to use (1st, 2nd, 3rd ...)
oSheet := oExcel:Sheets( nI )
oTemp := oSheet:Range( the range U want to copy ) //Range( "A1","AL37" )
oTemp:copy()
// I open a new excel file select a sheet then paste
oSheet2:paste()
function Main()
local oWord, oExcelRange, oDoc
oWord := WinWordObj()
if oWord == nil
MsgStop( "Can not open Word Application" )
return nil
endif
oExcelRange := GetExcelRange( "c:\fwh\samples\compare.xls", "Regions", "Sales" )
if oExcelRange == nil
MsgStop( "Can not read Excel Range" )
return nil
endif
oDoc := oWord:Documents:Add()
oExcelRange:Copy()
oDoc:Paragraphs( oDoc:Paragraphs:Count ):Range:InsertParagraphAfter()
oDoc:Paragraphs( oDoc:Paragraphs:Count ):Range:PasteExcelTable( .t., .f., .t. )
oWord:Visible := .t.
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 68 guests