Reputation: 103
i have function:
Function importCSV(fileName As Variant) As Boolean
' some code
' no importCSV = TRUE
end Function
i call this function
importCSV (fileName As Variant)
every do OK, bud when a modific function.
Function importCSV(fileName As Variant, linkToHeader As Boolean) As Boolean
' some code
' no importCSV = TRUE
end Function
i cant call function like this
importCSV (fileName As Variant, TRUE)
VBA detect syntax error and a must call
a = importCSV(fileName As Variant, TRUE)
Why?
Upvotes: 6
Views: 23151
Reputation: 470
To avoid assigning the return value to any variable you can use call
keyword
call importCSV(fileName As Variant, TRUE)
Additionally you can call the function this way:
importCSV fileName:="File name", linkToHeader:=TRUE
Upvotes: 17