Hi, to preface my question, I'm not very experienced in writing code so I wont understand complex answers.

The problem I am having is I am trying to convert a string to a date.

I am using the following code

Dim Current_Date As String
Dim D As Integer
Dim M As Integer
Dim Y As Integer


D = Current_Date.Substring(0, 2)
M = Current_Date.Substring(2, 2)
Y = Current_Date.Substring(4, 4)
MsgBox (CDate(D & M & Y))

End Sub



The problem is occuring when it gets to the D variable, the error says Compile error; Invalid qualifier.

Can anyone help?