JAN777
03-25-2003, 06:16 AM
How can I put some values from VB to Excel. It must be an existing excel file in some speciefied cells.
I've heard that I can use a macro. but how can I use that?
It doesn't have to be a macro.
Greetzzzzz
Laurent
03-25-2003, 07:20 AM
here is how i do it, first create your document in an excel file, set the print area and all the page properties then save it.
in your vb application click on project then reference, in this window find microsoft excel 9.0 and check it
then you need to create an excel object to use the document so you do like this
Dim obExcelApp As Workbook 'create the object
Set obExcelApp = GetObject("G:\Laurent\confirmRecepComm.xls" ) ' initialize it
obExcelApp.Worksheets(Index).Range("a13" ) = cmbListeContacts.Text 'implement the cells needed, index here is the worksheet index
...
obExcelApp.Worksheets(Index).PrintOut 'print it out
obExcelApp.Close (False) 'close the document
Set obExcelApp = Nothing 'free the memory space
i hope i'm clear enough, if you need more let me know