I know this question have been asked several time in different form but I have tried several ways to solve this issue but not getting any that could help me.
The main problem is that I have an Excel VBA Userform that throws error of the following kind for Mac user :
"
Run_Time error '429': ActiveX Component Cant't Create Object
"
I tried several solutions like:
1.Adding Reference of Regular Expression since my code uses regex. But on going through various pages, I found that Microsoft vbscript regular expressions object library doesn't exists for Mac.
So I followed this link which asked me to download .pkg file and add it to the VBA library but this showed error like "This file is not supported". RegEx with Excel VBA on Mac
2.Replacing CreateObject
I followed this link Excel VBA alteration for MAC
Replaced Set regex = CreateObject("VBScript.RegExp") with Dim regex As New VBScript.RegExp
(THIS TOO DIDN'T WORKED)
The error causing code:
Dim edi_ec, edi_doc, method_implement, van As String
Dim Situacao As String
Dim regex As Object
**Set regex = CreateObject("VBScript.RegExp")** // THIS LINE //
COMPLETE CODE :
Dim edi_ec, edi_doc, method_implement, van As String
Dim Situacao As String
Dim regex As Object
Set regex = CreateObject("VBScript.RegExp")
'Checking the 1st four fields
If TextBox1.Value = "" Then
MsgBox "Company Name Cannot be empty"
TextBox1.SetFocus
Exit Sub
End If
'1. EDI/EC profiles checkboxes conversion to string
edi_ec = ""
If CheckBox1 = True Then
edi_ec = "Edifact"
End If
If CheckBox2 = True Then
If edi_ec = "" Then
edi_ec = "ANSI X12"
Else
edi_ec = edi_ec & ", ANSI X12"
End If
End If
'2. list of documents
Dim trans_std_ver As String
trans_std_ver = ""
trans_std_ver = "Transaction Type 1 :" & Me.TextBox86.Value & " Version Used: " & Me.TextBox87.Value
If TextBox68.Visible = True Then
trans_std_ver = "Transaction Type 2: " & Me.TextBox68.Value & " Version Used: " & Me.TextBox75.Value
End If
'3 Value Added Network Provider
van = ""
If CheckBox25 = True Then
van = "Sterling Commerce"
End If
If CheckBox26 = True Then
If van = "" Then
van = "GXS/Opentext (Edi Express, Tradent or TGMS)"
Else
van = van & ", GXS/Opentext (Edi Express, Tradent or TGMS)"
End If
End If
If CheckBox27 = True Then
If van = "" Then
van = "Inovis"
Else
van = van & ", Inovis"
End If
End If
'4. senders and receivers ID's and Qualifiers for TEST & PRODUCTION
Dim test, production As String
test = "TEST ID 1: " & Me.TextBox46a.Value & " QUALIFIER: " & Me.TextBox47.Value
production = "PRODUCTION ID 1: " & Me.TextBox49.Value & " QUALIFIER: " & Me.TextBox48.Value
If TextBox52.Visible = True Then
test = test & ", TEST ID 2: " & Me.TextBox52.Value & " QUALIFIER: " & Me.TextBox53.Value
production = production & " PRODUCTION ID 2: " & Me.TextBox54.Value & " QUALIFIER: " & Me.TextBox51.Value
End If
'5 Method of communication other than VAN
Dim van_other As String
van_other = ""
If CheckBox30 = True Then
van_other = "AS2"
End If
If CheckBox31 = True Then
If van_other = "" Then
van_other = "FTP(S) / SFTP"
Else
van_other = van_other & ", FTP(S) / SFTP"
End If
End If
Dim comment As String
If TextBox67.Value <> "" Then
comment = TextBox67.Value
End If
'feeding the data to the spreadsheet
RowCount = Worksheets("Sheet1").Range("A1").CurrentRegion.Rows.count
With Worksheets("Sheet1").Range("A1")
.Offset(RowCount, 0).Value = Me.TextBox1.Value
.Offset(RowCount, 1).Value = Me.TextBox2.Value
.Offset(RowCount, 2).Value = Me.TextBox3.Value
.Offset(RowCount, 3).Value = Me.TextBox4.Value
.Offset(RowCount, 4).Value = edi_ec
'.Offset(RowCount, 5).Value = edi_doc
.Offset(RowCount, 5).Value = trans_std_ver
.Offset(RowCount, 6).Value = method_implement
.Offset(RowCount, 7).Value = van
.Offset(RowCount, 8).Value = test
.Offset(RowCount, 9).Value = production
.Offset(RowCount, 10).Value = van_other
.Offset(RowCount, 11).Value = comment
'.Offset(RowCount, 11).value = text
End With
'Clearing the contents of the form on clicking submit
Dim ctl As MSForms.Control
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "TextBox"
ctl.text = ""
Case "CheckBox", "OptionButton", "ToggleButton"
ctl.Value = False
Case "ComboBox", "ListBox"
ctl.ListIndex = -1
End Select
Next ctl
Unload Me
End Sub
As stated I have tried all the possible ways but ended up with no solution. Is there any way(consistent with both Windows and Mac) where Regex library can be called from within the program as I have to sent this Userform to some non-technical people who have no clue about all this except the userform?
Thanks in advance.