ginger0001
Member
- Joined
- Mar 15, 2012
- Messages
- 7
- Programming Experience
- Beginner
How can I correct this?
In vb
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
Dim oExcel1 As Excel.Application
Dim oBook1 As Excel.Workbook
Dim oBooks1 As Excel.Workbooks
Dim oSheets1 As Excel.Sheets
Dim oSheet1 As Excel.Worksheet
Dim FirstName As String
'\\\\\------------/////
oExcel1 = CreateObject("Excel.Application")
oBooks1 = oExcel1.Workbooks
oExcel1.Visible = True 'if you want to see it FALSE if not
oBook1 = oBooks1.Open("C:\Documents and Settings\Administrator\Desktop\7typesexcel10032012.xlsm")
oSheet1 = oBook1.Worksheets(1)
oExcel1.DisplayAlerts = True
FirstName = TextBox1.Text
oExcel1.Run("Sheet1.testmacro", FirstName)
End Sub//error on the line oExcel1.Run("Sheet1.testmacro", FirstName)
In vba
Private Sub testmacro(ByVal FirstName As String)
MsgBox FirstName
Set Range("A1").Value = FirstName
End Sub
THANK YOU
In vb
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
Dim oExcel1 As Excel.Application
Dim oBook1 As Excel.Workbook
Dim oBooks1 As Excel.Workbooks
Dim oSheets1 As Excel.Sheets
Dim oSheet1 As Excel.Worksheet
Dim FirstName As String
'\\\\\------------/////
oExcel1 = CreateObject("Excel.Application")
oBooks1 = oExcel1.Workbooks
oExcel1.Visible = True 'if you want to see it FALSE if not
oBook1 = oBooks1.Open("C:\Documents and Settings\Administrator\Desktop\7typesexcel10032012.xlsm")
oSheet1 = oBook1.Worksheets(1)
oExcel1.DisplayAlerts = True
FirstName = TextBox1.Text
oExcel1.Run("Sheet1.testmacro", FirstName)
End Sub//error on the line oExcel1.Run("Sheet1.testmacro", FirstName)
In vba
Private Sub testmacro(ByVal FirstName As String)
MsgBox FirstName
Set Range("A1").Value = FirstName
End Sub
THANK YOU