问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/43228686/vba-call-function-without-return-variable