Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Disable AskAQuestion Dropdown

4 views
Skip to first unread message

Will Handley

unread,
Dec 21, 2002, 6:43:03 PM12/21/02
to
I need to disable the askaquestion dropdown (make it
invisible) from code within an add-in. This can be done
with "Application.CommandBars.DisableAskAQuestionDropdown
= true" However, since this property did not exist prior
to Excel XP, when the applicaton is run under Excel 2000
or 97, etc, I get a compile error.

Anyone know of a way to do this is a generic way that will
pass older version's compiler edits? If I could somehow
address that property with a subscript, or find it in a
collection ...

Ron de Bruin

unread,
Dec 21, 2002, 8:54:08 PM12/21/02
to
Sorry typo(to much beer I think, 2:52 here time for bed I think)


Sub a()
If Application.Version = 10 Then
Application.CommandBars.DisableAskAQuestionDropdown = True
End If
End Sub


--
Regards Ron
www.rondebruin.nl


"Ron de Bruin" <ronde...@kabelfoon.nl> schreef in bericht
news:uft7sjVqCHA.2256@TK2MSFTNGP12...
> Try this
>
> If Application.Version = 10 Then
> Application.DisableAskAQuestionDropdown = True
> end if
>
> this will check the version
>
> --
> Regards Ron
> www.rondebruin.nl
>
>
> "Will Handley" <willh...@comcast.net> schreef in bericht
> news:04aa01c2a94a$b44cc7c0$89f82ecf@TK2MSFTNGXA01...

Ron de Bruin

unread,
Dec 21, 2002, 8:24:56 PM12/21/02
to
Try this

If Application.Version = 10 Then
Application.DisableAskAQuestionDropdown = True
end if

this will check the version

--
Regards Ron
www.rondebruin.nl


"Will Handley" <willh...@comcast.net> schreef in bericht
news:04aa01c2a94a$b44cc7c0$89f82ecf@TK2MSFTNGXA01...

Will Handley

unread,
Dec 22, 2002, 5:24:11 AM12/22/02
to
Dank u voor uw goede raad, Ron, maar het problem is dat
mijn program ook in Exel 2K en 97 loopen moet. Daarmee
ontstaat een compilerfout want het
property "DisableAskAQuestionDropdown" voor 2002 niet
bestaat.

Thanks, Ron, but the problem is that my program must run
in Exel 2K and 97 as well, and I get a compiler error
with "DisableAskAQuestion" because this property did not
exist before 2000. I was really looking for a way to refer
to that property generically. You can refer to an object,
for example, using a subscript (CommandBars("file") or
CommandBars(1), etc.

>.
>

Ron de Bruin

unread,
Dec 22, 2002, 5:57:30 AM12/22/02
to

Hi Will

I don't see what the problem is with my example
It will only run the line when you run it in 2002

This example from Chip you can use also

Sub test()
#If VBA6 Then
On Error Resume Next
Application.CommandBars.DisableAskAQuestionDropdown = True
If Err.Number = 0 Then
MsgBox "2002"
Else
MsgBox "2000"
End If
#Else
MsgBox "XL97"
#End If
End Sub


--
Regards Ron
www.rondebruin.nl


"Will Handley" <willh...@comcast.net> schreef in bericht

news:03d901c2a9a4$45250560$d2f82ecf@TK2MSFTNGXA09...

Will Handley

unread,
Dec 22, 2002, 7:19:04 AM12/22/02
to
I hope I'm wrong, because then I can wrap this up and move
on! But, while a module referring to that property
compiles OK in XP, I get the following message when I
compile it under Excel 2000 (Click "Compile VBA Project"
on the Debug menu):

"Compile error: Method or data member not found" and the
property "DisableAskAQuestionDropdown" is highlighted.

If I just save as an add-in without compiling, when I try
to load the addin, I get a message "Compile error in
hidden module," so apparently it is necessary for the code
to compile.

You can see perhaps now why I am seeking a way to refer to
that property generically, without naming it, perhaps with
an index, so that the 2000 (and presumably 97 as well)
compilers will let it by.

>.
>

Will Handley

unread,
Dec 22, 2002, 4:26:32 PM12/22/02
to
Just to close this out, someone has now pointed out to me
the significance of the #-signs in your code example. They
causes the older compilers to ignore the statement,
exactly what I was looking for.

Thanks for your help.

>.
>

Ron de Bruin

unread,
Dec 22, 2002, 4:56:49 PM12/22/02
to
I saw Dave posted and explane my(chip) code

--
Regards Ron
www.rondebruin.nl


"Will Handley" <willh...@comcast.net> schreef in bericht

news:03c101c2aa00$cc998410$89f82ecf@TK2MSFTNGXA01...

Tom Ogilvy

unread,
Dec 22, 2002, 5:09:50 PM12/22/02
to
Your Chip Code doesn't work for me. You can't suppress a compile error with
On Error Resume Next.

Regards,
Tom Ogilvy


Ron de Bruin <ronde...@kabelfoon.nl> wrote in message
news:OF7kCUgqCHA.2472@TK2MSFTNGP10...

Ron de Bruin

unread,
Dec 22, 2002, 5:27:57 PM12/22/02
to
Hi Tom

Sub test()
#If VBA6 Then
On Error Resume Next
Application.CommandBars.DisableAskAQuestionDropdown = True
If Err.Number = 0 Then
MsgBox "2002"
Else
MsgBox "2000"
End If
#Else
MsgBox "XL97"
#End If
End Sub

I just try it in Excel97 without any error??

I use somthing like this myself
And I never hear that anyone have a problem with it

Did you get a error on this also Tom

Sub userform_Open()
#If VBA6 Then
userform1.Show vbModeless
#Else
userform1.Show
#End If
End Sub


--
Regards Ron
www.rondebruin.nl


"Tom Ogilvy" <twog...@msn.com> schreef in bericht
news:OpWYrZgqCHA.1624@TK2MSFTNGP10...

Tom Ogilvy

unread,
Dec 22, 2002, 5:35:37 PM12/22/02
to
Not really: Both Excel 2000 and xl2002 use VBA6 and define VBA6 as true.


In Excel 2000

Sub Tester3()
Dim lngVal as Long
#if VBA6 then
lngVal = 100
#Else
lngVal = 3
#end if
msgbox lngVal
End Sub

produced 100, in xl97, it produced 3.

I couldn't find the
DisableAskAQuestionDropdown

Property in xl2000.

So I think you still have a problem. Let us know if not.

Regards,
Tom Ogilvy

Will Handley <willh...@comcast.net> wrote in message
news:03c101c2aa00$cc998410$89f82ecf@TK2MSFTNGXA01...

Ron de Bruin

unread,
Dec 22, 2002, 5:50:20 PM12/22/02
to
I search the example code and indeed you are right Tom as useal
The code will be run in all versions but it only can be compiled in
Excel 97 and 2002

By the way the code was from
Orlando Magalhães Filho

--
Regards Ron
www.rondebruin.nl


"Ron de Bruin" <ronde...@kabelfoon.nl> schreef in bericht

news:#mOFclgqCHA.1080@TK2MSFTNGP10...

Tom Ogilvy

unread,
Dec 22, 2002, 6:22:11 PM12/22/02
to
of course it works with xl97, but it doesn't work with xl2000. (it will
not compile in xl2000 ).

Regards,
Tom Ogilvy


Ron de Bruin <ronde...@kabelfoon.nl> wrote in message

news:#mOFclgqCHA.1080@TK2MSFTNGP10...

Dave Peterson

unread,
Dec 22, 2002, 8:02:36 PM12/22/02
to
See one more reply in .programming

--

Dave Peterson
ec3...@msn.com

Peter Beach

unread,
Dec 24, 2002, 2:57:53 AM12/24/02
to
Hi Tom,

How about late binding?

The following works in XL 2000 (haven't loaded XL XP so can't test it there,
but it reports "not 2002" correctly in my test):

Sub a()
Dim o As Object

Set o = Application

On Error Resume Next
o.CommandBars.DisableAskAQuestionDropdown = True


If Err.Number = 0 Then
MsgBox "2002"
Else

MsgBox "not 2002"
End If
End Sub

Regards,

Peter Beach

"Tom Ogilvy" <twog...@msn.com> wrote in message
news:uKxVGChqCHA.432@TK2MSFTNGP10...

Tom Ogilvy

unread,
Dec 24, 2002, 6:19:13 PM12/24/02
to
That's certainly clever.

Regards,
Tom Ogilvy


Peter Beach <pbe...@globe.net.nz> wrote in message
news:#zeczIyqCHA.2488@TK2MSFTNGP12...

Ron de Bruin

unread,
Dec 24, 2002, 7:16:09 PM12/24/02
to
Working Correct in 2002 Peter

Looking good

Thanks


--
Regards Ron
www.rondebruin.nl


"Peter Beach" <pbe...@globe.net.nz> schreef in bericht
news:#zeczIyqCHA.2488@TK2MSFTNGP12...

0 new messages