Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Two Questions...

Two questions about things working just fine on my
machine and not another:

1. Setting up a command bar:
I used "Set MyBar = CommandBars.ActiveMenuBar" and this
worked just fine. But, I take it to a different machine
and I have to Dim MyBar As CommandBar to get it to work.
Why is this? I have to Dim all of the CommandBar Buttons
too, rather than just using Set like on my machine. So,
if I Dim everything it works but that's alot of extra
lines of code.

2. Creating a MsgBox:
I have message that I want split into multiple lines so
on my machine I used Chr(13) which is the carrage return,
works just fine. But, the other machine doesn't recognize
Chr and I get an error. How can I get around this or what
file (library) do I need to install on the other machine
to get this to work?
example: MsgBox("Line #1" & Chr(13) & "Line #2")

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Two Questions...

(1)
Your other computer had the option "Require Variable Declaration" activated in VB Editor.

In VB Editor, from the Tools menu, choose Options, the Editor tab.

(2)
Try using Chr(10) instead.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Two Questions...

1. I have examples of CommandBars on my website.
2. Suspect broken references - I have some code for broken references on my
website.


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"R-Enemy" wrote in message
...
Two questions about things working just fine on my
machine and not another:

1. Setting up a command bar:
I used "Set MyBar = CommandBars.ActiveMenuBar" and this
worked just fine. But, I take it to a different machine
and I have to Dim MyBar As CommandBar to get it to work.
Why is this? I have to Dim all of the CommandBar Buttons
too, rather than just using Set like on my machine. So,
if I Dim everything it works but that's alot of extra
lines of code.

2. Creating a MsgBox:
I have message that I want split into multiple lines so
on my machine I used Chr(13) which is the carrage return,
works just fine. But, the other machine doesn't recognize
Chr and I get an error. How can I get around this or what
file (library) do I need to install on the other machine
to get this to work?
example: MsgBox("Line #1" & Chr(13) & "Line #2")

Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Two Questions...

Re your first question :-

Is the "Option Explicit" statement present in the General
Declarations section of the code module in which you have
placed your code? That would force you to "Dim" variables
etc. before initialisation/use.
================================================== =======
Re your second question:-

Use the predefined VB constant "vbCrLf", instead of
Chr(13). That should work anywhere.

Regards
Chris



-----Original Message-----
Two questions about things working just fine on my
machine and not another:

1. Setting up a command bar:
I used "Set MyBar = CommandBars.ActiveMenuBar" and this
worked just fine. But, I take it to a different machine
and I have to Dim MyBar As CommandBar to get it to work.
Why is this? I have to Dim all of the CommandBar Buttons
too, rather than just using Set like on my machine. So,
if I Dim everything it works but that's alot of extra
lines of code.

2. Creating a MsgBox:
I have message that I want split into multiple lines so
on my machine I used Chr(13) which is the carrage return,
works just fine. But, the other machine doesn't recognize
Chr and I get an error. How can I get around this or what
file (library) do I need to install on the other machine
to get this to work?
example: MsgBox("Line #1" & Chr(13) & "Line #2")

Thanks.
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Two Questions...

"Rob van Gelder" wrote in message ...
1. I have examples of CommandBars on my website.



Rob,

I have tried your code ref "Buttons for VBEIDE", but could only get it
to work by adding a reference to "Microsoft Visual Basic for
Applications Extensibility". Is this actually required? If so, the
information line is missing from your site.

Secondly, is there any way to stop the screen changing to the
worksheet (ie, stop the code exiting the VBEIDE)?

Cheers,

Mark
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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
View Questions and Answer to questions I created Roibn Taylor Excel Discussion (Misc queries) 4 July 24th 08 12:05 AM
007 questions Gklass Charts and Charting in Excel 0 February 4th 07 05:05 PM
2 questions Sally Sibthorpe Charts and Charting in Excel 9 July 26th 06 10:15 PM
Two little questions weeclaire Excel Discussion (Misc queries) 1 April 13th 06 12:36 PM


All times are GMT +1. The time now is 06:49 AM.

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

About Us

"It's about Microsoft Excel"