I want my program to write text to an excel file.
I want if that it always adds the new text. I have 4 textboxes, each textbox should be written in another cell, next to each other. If I add new information, these 4 things should appear beneath the 4 others.
I think it's not that hard, but I can't find how to do it...
I tried this for checking if it could be usefull:
Dim objUser, strExcelPath, objExcel, objSheet, objGroup
strExcelPath = "c:\UserGroup.xlsx"
objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add()
objSheet = objExcel.ActiveWorkbook.Worksheets(1)
objSheet.Name = "User Groups"
objSheet.Cells(1, 2).Value = "User Common Name"
objSheet.Cells(2, 2).Value = "sAMAccountName"
objSheet.Cells(3, 2).Value = "Display Name"
objSheet.Cells(4, 2).Value = "Distinguished Name"
objSheet.Cells(5, 2).Value = "Groups"
objExcel.ActiveWorkbook.SaveAs(strExcelPath)
objExcel.ActiveWorkbook.Close()
objExcel.Application.Quit()
objUser = Nothing
objGroup = Nothing
objSheet = Nothing
objExcel = Nothing
but it always creates a new excel file, so it does not add the info I am thinking of reading the excel first, then add the new info, and writing it again, but whatever I try, it doesn't work :( any help = greatly appreciated!
LW


Sign In
Create Account


Back to top









