How to change dimension's full name while creating an equation?

I want to create an equation such that sketch name change every time when i run the macro and it also change in the equation. Here is what i tried but could not be successful.

Dim value As Feature
Dim SkName As String

Dim Instance3 As String

Set value = Part.Extension.GetLastFeatureAdded()
SkName = value.Name
Debug.Print SkName

Instance3 = "D1@" & SkName
boolstatus = Part.Extension.SelectByID2("Equations", "EQNFOLDER", 0, 0, 0, False, 0, Nothing, 0)
Set swEquationMgr = Part.GetEquationMgr()

swEquationMgr.Add -1, """Instance3"" = SQR(""XC""*""XC""+""YC""*""YC"")*1in"

Please help if it can be changed.

Thanks!

SolidworksApi/macros