Error - Incorrect Function

O

Oggy

Hi
I have the following code in a addin to close a spreadshhet and go
back to the menu. Everything works fine but i keep getting a error
message Incorrect Function.


Sub backtomenupo()

Dim Filename As String
Filename = Range("z1").Value & ".xlsm"
Workbooks(Filename).Close savechanges:=True
Workbooks("Menu.xlsm").Activate
End Sub

Please advise how i can fix this problem

Thanks in advance
 
D

Dave Peterson

What line causes the problem?
What's in Z1 of the activesheet?
What's the exact error message that you see?
 
O

Oggy

What line causes the problem?
What's in Z1 of the activesheet?
What's the exact error message that you see?










--

Dave Peterson- Hide quoted text -

- Show quoted text -

The problem occurs when i run the macro
Range Z1 is the file name which is also a purchase order number
The error message is "Incorrect Function"

Thanks
 
D

Dave Peterson

So how do you run this subroutine?

What particular line causes the problem?
What's the actual value in Z1?
 
O

Oggy

So how do you run this subroutine?

What particular line causes the problem?
What's the actual value in Z1?








--

Dave Peterson- Hide quoted text -

- Show quoted text -

I am running Excel 2007 and the sub routine is run by a custom xml
ribbon button.
The value of Z1 varies but would be on a number and letters combines
ie PO15

Thanks
 
D

Dave Peterson

I don't know enough about the ribbon to know.
I am running Excel 2007 and the sub routine is run by a custom xml
ribbon button.
The value of Z1 varies but would be on a number and letters combines
ie PO15

Thanks
 
Top