VBA excel ByRef参数类型不匹配

时间:2017-01-19 14:34:37

标签: vba excel-vba excel

Excel中的VBA - 我正在尝试将自定义数据类型发送到这样的子类:

Public Type emailBody
  emailAddress As String
End Type

Sub SendEmail(email As emailBody)
   Dim queryString as String
   queryString = "email=" & email.emailAddress
   'email sending code goes here
End Sub

在我的表格中:

Private Type emailBody
  emailAddress As String
End Type

Private Sub sendemail_Click()
   Dim emailFields as emailBody
   Dim emailAddress As String
   emailFields.emailAddress = "myemail@example.com"  
   Call SendEmail(emailFields) 
End Sub

我收到此错误:

ByRef argument type mismatch

在这一行:

Call SendEmail(emailFields) 

来自javascript和PHP背景,所以不确定是什么引发了这个错误或者我错过了什么。

0 个答案:

没有答案