03-04-2024 07:28 AM
Hello,
I want to enter current date in excel cell and I use following sentence:
Excel.ActiveSheet.Cells(1,coloana).Value = CurrentDate (did not work)- no error but cell is still empty
Excel.ActiveSheet.Cells(1,coloana).Value = Date (did not work)- no error but cell is still empty
Could you help me with a solution?
Thank you in advance.
Solved! Go to Solution.
03-06-2024 08:40 AM - edited 03-06-2024 08:41 AM
Hey Alex.
Is this line all of your code? You need to open the file anywhere, assign the sheet in excel, and finally write the value there in.
If so, you need some more code.
The version below should work.
Greetings,
Vassili
Dim DataPath
Dim oExcel, oExcelSheet
Set oExcel = CreateObject("Excel.Application")
Const xlMaximized = &HFFFFEFD7
DataPath = "-your path-\" & "sample.xlsx"
oExcel.Visible = True
oExcel.WindowState = xlMaximized
oExcel.Workbooks.Open(DataPath)
Set oExcelSheet = oExcel.Workbooks("sample.xlsx").Sheets("Sheet1")
oExcelSheet.Cells(4, 2).Value = CurrDate
Set oExcelSheet = Nothing
Set oExcel = Nothing
03-07-2024 03:41 AM
Hello Vassili,
First of all, thank you for replay. Yes, I have all that lines in my code, but I did not manage to "write" data in cell, but I will try with that "CurrDate".
Anyway is anywhere a database or something with Excel properties like .values / .WindowState / .WorkBooks / .Open and so on?
I just searched on internet and ChatGpt but results are hard to get.
Regarding your suggestion about "CurrDate" I will try and come back with some feedback.
Have a great day!
Alexandru
07-19-2024 06:37 AM
Unfortunately I couldn't find something like a "description of the functions" for excel.
All I found comes from similar sources like this forum 🙂
07-19-2024 07:44 AM
Thank you! 🙂