Helpful Information
Category: Visual basic
Visual basic -->> Write on excel sheets????

I'm designing a soft in vb, but at some point i need to write some data to an excel sheet. This is the one i've tried:
- By windows appi: it works perfect, till the moment u open the application, the problem here is the following: The appi's run the app, but the apps takes time to load, and the code does not wait for that, it continues to the next sentence in the code in matter of seconds, and if the app it's still not opened then we get an error. There is an sleep method on the windows appi that makes a pause and wait for the time u program, but i don't want to use this cuz some people with fast machines, don't need to wait, and cuz it's not the best solution....
help plz...

Maybe you should give a try to OLE Automation....
Add Excel objects to your project's references and use the object browser on them to see what are they capable of.

well thanks for the reply, but any idea or tutorial or url to explain or have a look at this or something!
help will be appreciated

have the app read from the excel sheet first.

to write on an excel sheet u need to first open the app with a windows appi and the write on it with another one... i wish to do all this toguether... u'll see, what the app do is show a form with some labels, edits, and two buttons... u must introduce the values wich i ask for and the i validate them and write those values into an excel sheet....

SO any way out or any possible solution?

Here is an example. You don't even have to make it visible to write to excel.

Option Explicit

Dim XL As New Excel.Application
Dim XLW As Excel.Workbook

Private Sub Command1_Click()
XLW.ActiveSheet.Cells(1, 1) = 25

End Sub

Private Sub Command2_Click()
Dim pVisible As Boolean

pVisible = XL.Visible
pVisible = pVisible Xor True
XL.Visible = pVisible
End Sub

Private Sub Command3_Click()
Call Form_Terminate
End Sub

Private Sub Form_Load()
Set XLW = XL.Workbooks.Add
End Sub

Private Sub Form_Terminate()
Application.DisplayAlerts = False
Set XLW = Nothing
Set XL = Nothing
End Sub

hey thanks for the example and the reply.
i shall try that out and let you know whether it works in my code or not!
thanks once again!