Hi Shaji,
> Can I directly save a file generated through win_olecreateobject(excel)
> with a predefined file name (without giving file name)
Also responding to your previous post about a reference guide: If you
have Excel installed you probably also have a help file that specifies
everything you can do with Excel via OLE. Old versions of that help file
used to be called something like "VBAXL<version>.CHM". I don't know the
current name. Dig into the Office directory tree under Program Files.
About your current question, that is entirely up to the OLE server you
are talking to. Once you are "inside" an OLE server, like Excel, you
have to do things the way that OLE server wants. And regarding a file
name, you have to provide that in one way or another.
You create an instance of the class "Excel.Application" with
oExcel := win_oleCreateObject( "Excel.Application" )
Then you talk to that object, call its methods and access its properties
(what we call instance variables in a Harbour class) according to the
published object model of the class in question (the help file if you
can find it).
There are many examples of talking to Excel (specifically) in old
threads in this group. Look them up, and you will see how to talk to
that specific class and make it behave like you want it to do. It might
look something like this:
oExcel := win_oleCreateObject( "Excel.Application" )
oExcel:WorkBooks:Add()
oSheet := oExcel:Sheets( 1 )
oSheet:Cells( 1, 1 ):Value() := "Hello world"
oExcel:ActiveWorkbook:SaveAs( "c:\temp\hello.xlsx" )
(I have not tested this small example since I no longer have Excel
installed here, but it is the general way to do it, anyway)
Also, regarding Excel, there are hundreds of websites dedicated to
educating application programmers about various Excel related aspects
using Visual Basic for Applications (VBA) over OLE. Doing it from
Harbour is very similar. Compare how those websites do it to the
solutions already published here by members of the group, and you will
soon see how to talk to Excel. It is not really difficult if you have
started by reading a few examples.
Regards,
Klas