Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mac Office 2004 Excel not running Excel 2003 macro

Status
Not open for further replies.

altsnd

Technical User
Dec 1, 2009
7
GB
(Re-posting - was mistakenly in VB5/5 forum - sorry!)

My client has asked for a simple macro to toggle pictures (inserted from clipboard) via buttons in the sheet. The macro I wrote works as it's supposed to on Excel 2003, however my client has a Mac with Office 2004, and reports that "nothing is happening".

I use form buttons (not ActiveX), and I see nothing in the few lines of code that would explain why this isn't working in Office 2004.

The code in the client's document is as follows:

(in a separate module:)
Sub togglePic(picname As String)
ActiveWorkbook.ActiveSheet.Shapes(picname).Visible = Not (ActiveWorkbook.ActiveSheet.Shapes(picname).Visible)
End Sub

(on the sheet with the button on:)
Sub name_Click()
Call togglePic("name")
End Sub

for a checkbox called "name" on the ActiveSheet, referring a picture called "name". (The picture name gets set when I first generate this code by another macro (for each picture individually) before I send the file on to my client.)

Does anyone have ANY ideas? (Ruling out an obvious one: yes, my client has macros enabled. And he's running the latest OS (presumably Snow Leopard?)

Any help greatly appreciated!
 


hi,
for a checkbox called "name" on the ActiveSheet, referring a picture called "name".
That can be dangerous. I'd rename all the Pix or CheckBoxes.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Every picture is named differently; but I do use the same name for the picture and the associated checkbox (makes passing the name easier) - is that what you're referring to as dangerous? You thinking naming conflicts? I do have a check when I create the checkboxes for the Type of the Shape, and it runs smoothly (in Excel 2003 - why would Mac Office 2004 balk?

Sorry, I would just try and see if it makes a difference, but I don't have access to a Mac right now, and I need a good reason to have my client test sth - if you happen to know it?

Thanks!
 


Frankly, I cannot get Excel to name a second shape with an identical name.

I REALLY doubt that you do have TWO shapes on the sheet with identical names.

Try removing the ActiveWorkbook object reference, as ActiveSheet IMPLIES the active workbook.


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I really really do have the same name for the picture and the checkbox! This isn't supposed to be possible? Huh! Curious now! My creation of the buttons goes as follows:

- I get the picname from a user form text input,
- assign it to the current selection (if that is of Type picture) (I use current selection because the pictures are pasted in from clipboard one after another),
- create a checkbox with that same name (following a couple checks of whether already exists etc.),
- and write out the VB code for the button.

When I have it write out all the names in the Shapes collection it does return each twice, one for the picture, one for the checkbox.

Now I think about it I'm puzzled too that that IS working, you're right. Bizarre...!


Anyway, I guess I'll need to arrange access to a Mac somewhere after all to play around with these things. I'd hoped there'd be some known issue with Office 2004 that I just wasn't seeing, but I guess it's just Excel 2003 being more forgiving of me!

Thanks for the help, SkipVought.
 



Did you try removing the reference to the active workbook?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Not for Office 2004 - like I said I don't have access to a Mac right now (Excel 2003 doesn't seem to care either way). I'll be sure to post back when I get a chance to play with someone's Mac!

(Got another issue with Office 2004 too.. new thread tho!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top