Syntax inside a class module to call a built-in function

Guraknugen

New Member
Joined
Mar 15, 2017
Messages
30
Hi!

I'm working on a class for managing two dates. Right now I need a very simple WeekDay function, with the following syntax:
Code:
oMyObject.WeekDay(dDate As Date) As Long
The method looks, not very surprisingly, like this:
Code:
Private Function WeekDay(dDate As Date)
    WeekDay = WeekDay(dDate, vbMonday)
End Function
The idea is to use the already existing WeekDay function, but in this case VBA thinks that I try to use the class member WeekDay rather than the built-in WeedDay function.
So my question is: What is the syntax in this case to call the built-in WeekDay function from within this method in a class module?
 

lhartono

Board Regular
Joined
Nov 15, 2017
Messages
103
Code:
[COLOR=#0000cd]Private Function WeekDay(dDate As Date)
    WeekDay = [/COLOR][COLOR=#ff0000]VBA.[/COLOR][COLOR=#0000cd]WeekDay(dDate, vbMonday)
End Function[/COLOR]
 

Forum statistics

Threads
1,081,693
Messages
5,360,668
Members
400,592
Latest member
katekoz

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top