PDA

View Full Version : Help! Macro working in Excel 2003 but not working in Mac Excel 2004



Charles Chung
10-25-2004, 07:13 PM
I developed a macro in my Office Pro 2003 and it works fine. But my users are using Office XP & Mac Office 2004.

It works fine in XP platform and most of the buttons work fine for Office 2004 too, but except for the following:

I created a commandbarbutton called "Add Record". When the users clicks it, a form pops out and there is a combo box (pull-down menu) and a OK button inside. In the combo box's rowsource property, I set it to "Category_Items", which I have already defined by selecting "E10:E20" and giving it that name.

If the user selects the combo box in Office XP, he can see the items SHORTS, T-SHIRTS, SKIRTS inside. And after he clicks OK button, a row will be inserted and the values of the combo box will be copied to the worksheet.

But if you open it in Excel 2004, there would be nothing for you to choose in the combo box and when you click the OK button, you will receive an error...

Any comments are greatly appreciated! Thanks in advance!

The code of the OK button is as follows:

Public Sub cmdOK_Click()
Dim CurrentRow As Integer
Dim CopyRow As Integer
Dim Ws As Worksheet

Set Ws = ActiveWorkbook.ActiveSheet


'UnProtectSheet Ws 'wsPurchaseOrder


CopyRow = 16
CurrentRow = wsControl.Range("Record_CurrentRow")

'Copy a row from template
wsTemplate.Rows(CopyRow & ":" & CopyRow).Copy
Ws.Rows(CurrentRow & ":" & CurrentRow).Insert Shift:=xlDown

Ws.Cells(CurrentRow, D_) = cbxCategory.Value

CurrentRow = CurrentRow + 1
wsControl.Range("Record_CurrentRow") = CurrentRow

'ProtectSheet Ws 'wsPurchaseOrder

frmRecordDetail.Hide

End Sub

Charles Chung
10-25-2004, 07:29 PM
I just browse through other threads and just know that in UserForm:

Range.Copy method doesn't Work from Userform

This is a very disappointing news for me as it is a must request for users to select a category from the combox box and a new row is copied to the worksheet with the value of the category...

Charles Chung
10-27-2004, 06:38 PM
I fixed the problem!

I installed the SP1 for the user, and changed some code and it works!

In Mac the .RowSource property of combobox control is not supported!
The only way to add items is to use the AddItem method. The poor thing is that I need to hard code the items in the VBA code for simlicity. Rather than I can specify a range of cells and put it in the .RowSource property for Office XP/2003