Please advise 开发者_JAVA技巧me what is wrong with my Excel 2007 macro thank you very much
The function needs one or more parameters (argument) which you didn't provide. And since that argument is not optional, meaning you have to provide it, Excel can't execute your macro.
If a parameter is supposed to be sent to a function by its definition but it is not sent, this error occurs. Please note that you can assign optional paramters like this:
Function Something(ByVal text as String, Optional number as Long = 26)
By placing the Optional keyword, the function can still be called even without that paramater being passed in to it. The = xxx is where you put the default value in the case that it is not provided.
If you decide not to declare the type of the Optional paramter (making it a Variant), you can use the ultra convenient IsMissing() function to see if it was passed in or not.
You are not passing a number into the second call to inchesToPoints()
Seems like function .InchesToPoints()
needs argument to be passed.
Like you have passed value 0.36 in your first call of .InchesToPoints()
for variable .LeftMargin
Pass the proper argument for function called for variable .RightMargin
精彩评论