I have looked over the forum for a simple export to Excel spreadsheet, but haven't found the right thing yet. What is a simple way to export information from a text box to a particular cell in Excel(A1)?
Any ideas would be appreciated.
Thanx
Printable View
I have looked over the forum for a simple export to Excel spreadsheet, but haven't found the right thing yet. What is a simple way to export information from a text box to a particular cell in Excel(A1)?
Any ideas would be appreciated.
Thanx
oh yeah, there is one other qualifier, I wanted to open a particular excel file. For example c:\mydocuments\myexcel.xls then write to the cell(A1). That might explain it better.
Try this...
Make sure you reference the Microsoft Excel 9.0 Object Library... it won't work unless you do.Code:Private Sub Command1_Click()
Dim XLApp As Excel.Application
Dim wrkWorkbook As Excel.Workbook
Dim wrkSheet As Excel.Worksheet
Set XLApp = CreateObject("Excel.Application")
XLApp.Workbooks.Open ("c:\mydocuments\myexcel.xls")
Set wrkWorkbook = XLApp.ActiveWorkbook
Set wrkSheet = wrkWorkbook.ActiveSheet
XLApp.Visible = False
wrkSheet.Range("A1").Select
Selection = txtBox.Text
wrkWorkbook.Close True
Set wrkSheet = Nothing
Set wrkWorkbook = Nothing
Set XLApp = Nothing
End Sub
Good Luck!
newty25
reference the Microsoft Excel 9.0 Object Library
I am not familiar with this, could someone enlighten me
Thanx
VB Menu > Project > References > Microsoft Excel 9.0 Object Library... check it, and click OKay.
newty25
Thanks for your help with this. Works great!