Excel to VB and VB to Excel 
Author Message
 Excel to VB and VB to Excel

Hi !
I have an idea to let excel make some calculations for me
(its easyer for me to make formels in excel) i.e.

i put a number in a textbox in vb this number goes to
execel in a ark i.e cell A25. Excel makes the calc. and the
result is in i.e cell G34, this result shut go back to vb
in a textbox.
Is there sombody who can and will help me ????

Thanks.

* Sent from AltaVista http://www.*-*-*.com/ Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful



Sat, 20 Jul 2002 03:00:00 GMT  
 Excel to VB and VB to Excel
Here you are:

Option Explicit
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Private Sub Command1_Click()
' These lines move data from VB to Excel
    xlSheet.Cells(1, 1).Value = Text1.Text
    xlSheet.Cells(2, 1).Value = Text2.Text
    xlSheet.Cells(3, 1).Value = Text3.Text
' The next line fetches data from Excel into VB
    Text4.Text = Format(CCur(Abs(xlSheet.Cells(4, 1).Value)), "##,###.00")
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Set xlApp = New Excel.Application
    Set xlBook = GetObject("c:\temp\book1.xls")
    Set xlSheet = xlBook.Worksheets("Sheet1")
End Sub

Private Sub Form_Unload(Cancel As Integer)
    xlBook.Close False
    xlApp.Quit
    Set xlApp = Nothing
End Sub

Eric

Quote:
> Hi !
> I have an idea to let excel make some calculations for me
> (its easyer for me to make formels in excel) i.e.

> i put a number in a textbox in vb this number goes to
> execel in a ark i.e cell A25. Excel makes the calc. and the
> result is in i.e cell G34, this result shut go back to vb
> in a textbox.
> Is there sombody who can and will help me ????

> Thanks.

> * Sent from AltaVista http://www.altavista.com Where you can also find

related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is
Beautiful


Sat, 20 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB and Excel problem - VB corrupts Excel environment

2. Accessing VBIDE.VBE.VBProjects via Excel in VB .NET Causes Excel To Crash When App Terminates

3. Accessing VBIDE.VBE.VBProjects via Excel in VB .NET Causes Excel To Crash When App Terminates

4. Accessing VBIDE.VBE.VBProjects via Excel in VB .NET Causes Excel To Crash When Closed

5. Importing from Excel to Excel using VB.

6. Is this doable: drive Excel in VB without Excel installation

7. create EXCEL with VB without EXCEL installed

8. Vb - Excel with excel formulas

9. Excel OLE very slow, can't pass by ref into Excel Macro from VB

10. Write to an Excel file from VB without Excel present

11. optimizing performance and data transfer vb->excel and vb->vb

12. optimizing performance and data transfer vb->excel and vb->vb

 

 
Powered by phpBB® Forum Software