Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Create CommandBar in xl95 code - possible?

Is there any way of writing write code in an Excel95 workbook which
creates a CommandBar object (as distinct from a Toolbar object) when
opened in later versions i.e. code must work in Excel97 onwards but
not blow up in Excel95?

My first thought was conditional compilation but I find it's not
supported in Excel95 (VBA4?)

My second thought was to create an instance using late binding but
this won't work either. Not surprising because I know I can't
instantiate a CommandBar using early binding anyway i.e.

Dim oBar As Office.CommandBar
Set oBar = New Office.CommandBar ' << compile error

Any other ideas (or confirmation this just isn't possible)?

--
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Create CommandBar in xl95 code - possible?

Hi Jamieuk,

Is there any way of writing write code in an Excel95 workbook which
creates a CommandBar object (as distinct from a Toolbar object) when
opened in later versions i.e. code must work in Excel97 onwards but
not blow up in Excel95?


Write the code in a separate sub that is only called when the later
version opens your workbook.

You will get a compile error when you manually compile (not sure if
Excel 95 could do that), but it should run OK on both systems, since
VBA only compiles a sub when it is called.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Create CommandBar in xl95 code - possible?

Thanks for the suggestion but it didn't work I'm afraid. I wrote this
sub which is never called:

Sub NeverNever()
Dim c As CommandBar
End Sub

But when I tried to run my sub main I got an error, 'User Defined type
not defined', which I suppose is the xl95 equivalent of a compile
error because my sub main didn't run at all.

--

Jan Karel Pieterse wrote in message ...
Hi Jamieuk,

Is there any way of writing write code in an Excel95 workbook which
creates a CommandBar object (as distinct from a Toolbar object) when
opened in later versions i.e. code must work in Excel97 onwards but
not blow up in Excel95?


Write the code in a separate sub that is only called when the later
version opens your workbook.

You will get a compile error when you manually compile (not sure if
Excel 95 could do that), but it should run OK on both systems, since
VBA only compiles a sub when it is called.

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Create CommandBar in xl95 code - possible?

Hi Onedaywhen,

Thanks for the suggestion but it didn't work I'm afraid. I wrote this
sub which is never called:

Sub NeverNever()
Dim c As CommandBar


Maybe defining c as an object will pass the test?
Or maybe putting all non-95 stuff in a separate module?

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Create CommandBar in xl95 code - possible?

JKP,
Good thinking! When I put sub NeverNever in a separate module I get no
error. Many thanks.

--

Jan Karel Pieterse wrote in message ...
Hi Onedaywhen,

Thanks for the suggestion but it didn't work I'm afraid. I wrote this
sub which is never called:

Sub NeverNever()
Dim c As CommandBar


Maybe defining c as an object will pass the test?
Or maybe putting all non-95 stuff in a separate module?

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Create CommandBar in xl95 code - possible?

Hi Onedaywhen,

When I put sub NeverNever in a separate module I get no
error.


Good, another problem solved!

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Xfer of XL95 custom menus into XL97 windsurferLA Excel Worksheet Functions 2 February 1st 05 11:33 PM
Editing XL95 custom menus with XL97 windsurferLA Excel Worksheet Functions 11 February 1st 05 06:26 PM
Cannot create transparent XP CommandBar picture jamieuk Excel Programming 0 January 28th 04 05:13 PM
Create new commandbar with call procedure Tonmai Excel Programming 1 September 26th 03 09:00 AM
VBA for XL95, Workbook.open non XL-file Dick Kusleika[_2_] Excel Programming 0 September 6th 03 02:49 AM


All times are GMT +1. The time now is 10:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"