determining a Commndbar name from a cell
strTBarName = "Worksheet Menu Bar"
set ctBar = CommandBars(strTBarName)
? ctBar.Name
Worksheet Menu Bar
? ctBar.controls(1).Caption
&File
Never heard of a variable not set error. I would get a subscript out of
range if strTBarName does not identify a valid Toolbar.
--
Regards,
Tom Ogilvy
"davegb" wrote in message
oups.com...
Thanks, Tom. But now I'm getting a variable not set error with that
line. cTBar is publicly declared in another module in this worksheet.
Any ideas?
Tom Ogilvy wrote:
Set cTBar = CommandBars(strTBarName)
--
Regards,
Tom Ogilvy
"davegb" wrote in message
ps.com...
This macro is supposed to show a particular Commandbar by getting the
name, previously saved, from cell "E2" in the named spreadsheet. I'm
getting an "invalid use of property" error on the marked line. I've
tried about 6 different ways of coding this, but none of them have
worked.
Private Sub Workbook_Activate()
Dim strTBarName As String
strTBarName = Workbooks("PIP DD Template HideTbar.xls") _
.Worksheets("Macro Records").Range("E2").Value
Set cTBar.Name = strTBarName <---ERROR
cTBar.Visible = True
So I can't set the object's name, only the object. How do I make the
object be the one named in the referenced cell ("E2")?
Thanks for the help.
|