-
Well there's an error with the Excel code in that you refer to cbItem, which doesn't exist.
[VBA]cbItem.TooltipText = MyValue
'should be
newMenu.TooltipText = MyValue[/VBA]
That said, I don't really understand the logic behind this code...
here's what's happening at the moment: (assuming this is distributed as an AddIn)
User opens Excel
the AddIn loads
The setup routine builds a new toolbar
The InputBox adds the tooltip
Now, while that session on Excel remains open, the menu and it's tooltip remain (but it's not saved anywhere)
When the user closes Excel, the AddIn unloads
When the user re-starts Excel, we go back to the first list and the user will have to set the variable again.
The reason this works in Word, is that the menu and its settings are saved in the user's Normal.dot, so that value remains. Because Word uses the Normal.dot in the user's profile this work for everyone based on their login.
In Excel, when you distribute an addin, the menu is re-built every time.
If you need to save it between sessions you can save it in the AddIns worksheet (worksheets in AddIns are hidden but accessible to the code)
If the user is given instructions to install the AddIn to their profile's AddIn directory, again it will be user independant.
[VBA]'IN setup
'you wouldn't need a variable to save it
ThisWorkbook.Sheets("Sheet1").Range("A1").Value = _
InputBox("Enter your Post", "Amend User", "<Post Title>")
ThisWorkbook.Save
'IN UserForm_Initialize
'You won't need to loop through the menus to get the tooltip
'The variable doesn't need to be global now
'you can declare it in the UserForm_Initialize routine
UserPost = ThisWorkbook.Sheets("Sheet1").Range("A1").Value[/VBA]
No such luck, however, with PowerPoint - AFAIK an AddIn can't be referred to as a presentation so there's nowhere to save the value.
Looking at this project it does occur to me that you would get the same functionality by saving a user profile in the registry.
The advantage would be that the user would only have to set it once - all the applications could use the same value.
The code could be identical in each application.
K :-)

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules