Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    MAC AND PC (Excel 2003)

    Hi all, does any one have an explaination for the reason a Mac does not accept functions, I have a spreadsheet on a PC, but when I use it in MAC, it keeps giving me a compile error.

    Thanks,
    Darryl.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MAC AND PC (Excel 2003)

    Not without seeing the function.
    Legare Coleman

  3. #3
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: MAC AND PC (Excel 2003)

    Thank you for your reply.... the function is a simple string function used to populate a listbox...

    Darryl.


    Public Function GetPrePress() As String()
    Dim y As Integer
    Dim x() As String
    y = 0
    ReDim Preserve x(y)
    x(y) = "Solid Ink Density"
    y = y + 1
    ReDim Preserve x(y)
    x(y) = "Print Contrast"
    y = y + 1
    ReDim Preserve x(y)
    x(y) = "1/4 Tone 3 colour grey Dmax"
    y = y + 1
    ReDim Preserve x(y)
    x(y) = "1/2 Tone 3 colour grey Dmax"
    y = y + 1
    ReDim Preserve x(y)
    x(y) = "Trap"
    y = y + 1
    GetPrePress = x
    Erase x
    End Function

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MAC AND PC (Excel 2003)

    Do you get the compile error in this function? If so, which line is highlighted?
    Or do you get it when you try to populate the list box using this function? If so, which line is highlighted?

    BTW, why the convoluted code with multiple ReDims if you know you're going to add 5 items?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MAC AND PC (Excel 2003)

    Update: it turns out that you cannot assign one array to another (GetPrePress = x) in Macintosh VBA. Instead of using the function to populate the list box, use the AddItem method to add the items one by one:

    With UserForm1.ListBox1
    .AddItem "Solid Ink Density"
    .AddItem "Print Contrast"
    .AddItem "1/4 Tone 3 colour grey Dmax"
    .AddItem "1/2 Tone 3 colour grey Dmax"
    .AddItem "Trap"
    End With

    where UserForm1 is the name of the form and ListBox1 is the name of the list box. If you put the code in the userform module, you can use Me instead of UserForm1.

  6. #6
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: MAC AND PC (Excel 2003)

    Thanks Hans.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •