DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Diadem Script: How to insert date in Excel Cell

Solved!
Go to solution

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.

0 Kudos
Message 1 of 5
(783 Views)
Solution
Accepted by topic author Alex_SI

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

 

 

Message 2 of 5
(748 Views)

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

0 Kudos
Message 3 of 5
(729 Views)

Unfortunately I couldn't find something like a "description of the functions" for excel.

All I found comes from similar sources like this forum 🙂

 

 

0 Kudos
Message 4 of 5
(263 Views)

Thank you! 🙂

0 Kudos
Message 5 of 5
(257 Views)