Forum Discussion
mjvdlugt
Jul 21, 2023Copper Contributor
Variable uses an Automation type not supported in Visual Basic
In Excel (MAC version)
I have programmed a simple Class module:
Option Explicit
Public Sub Init( _
Optional ByVal xID, _
Optional ByVal xName, _
Optional ByVal xISIN, _
Optional ByVal xAssetCurrency, _
Optional ByVal xCountry, _
Optional ByVal xIncomeAccount,
Optional ByVal xCapitalAccount, _
Optional ByVal xCeasedDate)
End Sub
When calling this Class by
Sub test()
Dim asset As CAsset
Set asset = New CAsset
asset.Init
End Sub
I get an error 456 message: "Variable uses an Automation type not supported in Visual Basic"
Does anyone know how to resolve?
1 Reply
Sort By
You're missing a line continuation character _ after xIncomeAccount,
It should be
Public Sub Init( _ Optional ByVal xID, _ Optional ByVal xName, _ Optional ByVal xISIN, _ Optional ByVal xAssetCurrency, _ Optional ByVal xCountry, _ Optional ByVal xIncomeAccount, _ Optional ByVal xCapitalAccount, _ Optional ByVal xCeasedDate) End Sub
With that change, the Test macro runs without error on my PC.