cancel
Showing results for 
Search instead for 
Did you mean: 

Running VBA script for Date time removal

DavidO_Sullivan
Level 2
Hi - 
I've generated a script to remove the time from the datetime in order to get a pooled filter.
The Vba code will not copy directly across to Blue Prism.
Therefore, I am looking to call the script directly.
I have saved it in RPA_Functions(In excel Module) and with each instance of opening the desired workbook, I am looking to call this vba into action.
The data is homogenous, so there is no need to change the VBA script for filtering, but I'm curious to see is it possible to nest something like::
'
Private Sub Workbook_Open()
    Call RPA_Functions.CreateShortcut
End Sub
'
Within the VBO at the beginning of my process in the VBO open workbook.
28825.png
I'd rather not change the object at the source.
The script used to filter the datetime is below, this works fine it's the above option that interests me.
Any and all advice is very much appreciated.

'
Sub CreateShortcut()
    Application.OnKey "+^{C}", "dropDateTime"
   
End Sub
Sub dropDateTime()
Dim LR As Long, i As Long
LR = Range("Y" & Rows.Count).End(xlUp).Row
For i = 2 To LR
    With Range("Y" & i)
        .NumberFormat = "dd/mm/yy"
        .Value = CLng(.Value)
    End With
Next i
End Sub

'

------------------------------
David O'Sullivan
------------------------------
1 REPLY 1

GopalBhaire
Level 10
You can use Run Macro action after open workbook to run the macro dropDateTime

Or you can check the extending MS Excel VBO guide to move your code to BP MS Excel Object.

------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------