Fixo,
This is what I tried to run from a module, see the red comment where is hangs. am I doing this right?
any help appreciated, at your convienence......
Mark
'---------------------------------------------------------------------------------------
' Module : Module1
' DateTime : 2/25/2011 07:43
' Author :
' Purpose :
'---------------------------------------------------------------------------------------
Option Explicit
Sub gtc_tab_rename()
Dim tabrename As String
Dim s As String
Dim i As Long
Dim cnt As Integer
Dim newstr As String
Dim num As Double
Dim regex As RegExp [program stops here. Compile error user-defined type not defined]
Set regex = New RegExp
regex.IgnoreCase = False
regex.Global = False
tabrename = InputBox$("Enter the Project Number : ") 'Sets the project number for the tab.
If tabrename = "" Then End 'exits clean if the user hits cancel from the input box
'Confirm the project number
Msg = "You have entered " & tabrename & " is this correct?" ' Define message.
Style = vbYesNo + vbInformation + vbDefaultButton1 ' Define buttons.
Title = "gtc Confirm Project Number" ' Define title.
Ctxt = 1000 ' Define topic
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
Else: gtc_tab_rename ' User chose No. restart the program for another choice
End ' Leave The Program
End If
newstr = " & tabrename & "
regex.Pattern = "(acm-)(.*?)(-sht)(\d+)"
' Where:
' (acm-)- constant part
' (.*?) - any charachters you need to replace with 'newstr'
' (-sht)- constant part
' (\d+) - any digits
Dim olayout As AcadLayout
For Each olayout In ThisDrawing.Layouts
If Not olayout.ModelType Then
ThisDrawing.ActiveLayout = olayout
olayout.Name = regex.Replace(olayout.Name, "$1" & newstr & "$3" & "$4")
Debug.Print olayout.Name 'debug only
End If
Next
Set regex = Nothing
ThisDrawing.SetVariable "tilemode", 1
End Sub