views:

782

answers:

2
Private Sub importClipboard_Click()
    Dim data As Collection
    data = getClipboardData()
    ...do something...
End Sub

Function getClipboardData() As Collection
    ...do something...    
End Function

I am getting an "Argument not optional" compile error on the line:

data = getClipboardData()

What am I doing wrong? There no arguments to the getClipboardData() function - so how can I be missing one?

A: 

I know this is going to sound crazy, but it has happened to me before.

Is it possible that you have declared another function with the same name?

Ben Jones
+8  A: 

It's a bad error message, but your problem is a common one - you've got to put Set data = getClipboardData() as you're returning an object.

Joel Goodwin