VBA Run-time Error 1004

J

Jürgen Ruf

Hi,

I have written VBA code on Windows which causes an VBA run-time error
using Mac Excel 2004.

The error is caused by the following routine which is called by an
action of an button in the excel spreadsheet:


Private Sub CallFrmCountryCode()

Dim iRow As Integer

Application.ThisWorkbook.Sheets("Input").Unprotect "mtgssq"
Application.ThisWorkbook.Sheets("iso3166").Unprotect "mtgssq"

'The problem is caused with the next command
'Run-time error 1004: unable to get the buttons property of the
worksheet class

MsgBox ("Button: " &
Application.ThisWorkbook.Sheets("Input").Buttons(Application.Caller).Text)


iRow = ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row
frmCountryCode.txt_Auswahl = Cells(iRow, 3)
frmCountryCode.Show

Application.ThisWorkbook.Sheets("Input").EnableOutlining = True
Application.ThisWorkbook.Sheets("Input").Protect contents:=True,
userInterfaceOnly:=True, password:="mtgssq"
Application.ThisWorkbook.Sheets("iso3166").Protect "mtgssq"
End Sub

Doesn't Mac VBA support the button object ?
Any idea ?

Best regards


Juergen
 
J

JE McGimpsey

Jürgen Ruf said:
Doesn't Mac VBA support the button object ?
Any idea ?

Works fine for me.

When you get the error, what does Application.Caller return? Do you have
a button with that name on sheet "Input"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top