I am trying to data in an excel file to store it. I am able to save a file but I cannot set the actual files name.
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim path As String
'Start a new workbook in Excel
Set oExcel = CreateObject("Excel.Application"
Set oBook = oExcel.Workbooks.Add
'Add data to cells of the first worksheet in the new workbook
Set oSheet = oBook.Worksheets(1)
oSheet.Range("A1".Value = First
oSheet.Range("A2".Value = Last
oSheet.Range("A3".Value = Gender
oSheet.Range("A4".Value = Age
oSheet.Range("A5".Value = Weight
oSheet.Range("A6".Value = Feet
oSheet.Range("A7".Value = Inches
oSheet.Range("A8".Value = User
oSheet.Range("A9".Value = Password
oSheet.Range("A10".Value = Question
oSheet.Range("A11".Value = Answer
path = "C:\MyFiles\Visual Basic 6.0\Excel Storage\" + User
'Save the Workbook and Quit Excel
oBook.SaveAs path
oExcel.Quit
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim path As String
'Start a new workbook in Excel
Set oExcel = CreateObject("Excel.Application"
Set oBook = oExcel.Workbooks.Add
'Add data to cells of the first worksheet in the new workbook
Set oSheet = oBook.Worksheets(1)
oSheet.Range("A1".Value = First
oSheet.Range("A2".Value = Last
oSheet.Range("A3".Value = Gender
oSheet.Range("A4".Value = Age
oSheet.Range("A5".Value = Weight
oSheet.Range("A6".Value = Feet
oSheet.Range("A7".Value = Inches
oSheet.Range("A8".Value = User
oSheet.Range("A9".Value = Password
oSheet.Range("A10".Value = Question
oSheet.Range("A11".Value = Answer
path = "C:\MyFiles\Visual Basic 6.0\Excel Storage\" + User
'Save the Workbook and Quit Excel
oBook.SaveAs path
oExcel.Quit