How do I order alphanumerical layers in a document?

Dear all,


I am new in vba and programming, but I try my best. I have a document with more than 1000 layers, which are named numerical and alphanumerical. Because there were layers added within time, it's a whole mess, that has to be sorted. A colleague, who is no longer working, has already written a vba skript to order the numerical layers. Now I have to figure out how to order the alphanumerical layers too.

I have little programming experience. My first question leads to a good tutorial to understand and learn VBA. Is VBA from Office and Corel similar? Or is it the same?

Is there a webpage, where I can search and read about the commands in VBA?

There is the "Val" expression, that reads numbers from an alphanumerical vector. The alphanumerical layers are named e.g. Dem610 or Dem1660, that doesn't work with val. Is there an VBA expression that reads any number out of a vector?

edit 16:05

I am starting ... and I thought I have found a way to just get the numbers out of the alphanumerical layers, but it does not work right:

Sub Order_Alphanumeric_Layers()

MsgBox Val(Right$("Dem610", 3)) 'works great, I get 610

Dim num As Integer

If IsNumeric(Left$("ThisDocument.ActiveLayer.Name", 1)) = False Then 'I activated a layer called Dem610, so 6 caracters ...
If Len(ThisDocument.ActiveLayer.Name) = 6 Then
num = Val(Right$("ThisDocument.ActiveLayer.Name", 3))
End If
If Len(ThisDocument.ActiveLayer.Name) = 7 Then
num = Val(Right$("ThisDocument.ActiveLayer.Name", 4))
End If
End If
MsgBox num
End Sub

The message box gives me a 0 back, it should be 610 ...

What am I doing wrong? I would appreciate any hint.

Thank you all in advance

sebiml