ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Weird Macro Happenings (https://www.excelbanter.com/excel-programming/396997-weird-macro-happenings.html)

Tsunami3169

Weird Macro Happenings
 
First off thanks to everyone here. I've come here many time with
questions and was able to find answers. And when I posted my question
I've always got great help. Now I'm really stuck because it involves
macros not running in a workbook I share, on someone else's pc. They
get this error "Compile error: Can't find project or library. When I
click debug this line gets highlighted

wee1 = MsgBox("One of the worksheets you entered is incorrect. Please
enter the names again" _
, vbExclamation)

A coworker dimed this line then it worked. I have other msgboxes like
this that i did not dim.

The same goes for input boxes. and all of them are like this:
Wks2 = InputBox("Enter the name of the worksheet that is to be sent to
the stores")
Again coworker dimed it as a string and it worked on his pc. All the
while I never received an error message when running on my pc.

This is not a pressing question, just a puzzling one for me. All help
is greatly appreciated, and if more information is needed just let me
know.

Thanks


Pflugs

Weird Macro Happenings
 
This probably happened due to the way you broke the line. This is how the
line should look:

wee1 = MsgBox("One of the worksheets you entered is incorrect. Please
enter the names again" , _
vbExclamation)

Of course, due to the width limits of this forum window, the message was
broken into two lines. To do that in code, you need ending apostrophes (")
and "& _" to break strings into lines.

HTH,
Pflugs

"Tsunami3169" wrote:

First off thanks to everyone here. I've come here many time with
questions and was able to find answers. And when I posted my question
I've always got great help. Now I'm really stuck because it involves
macros not running in a workbook I share, on someone else's pc. They
get this error "Compile error: Can't find project or library. When I
click debug this line gets highlighted

wee1 = MsgBox("One of the worksheets you entered is incorrect. Please
enter the names again" _
, vbExclamation)

A coworker dimed this line then it worked. I have other msgboxes like
this that i did not dim.

The same goes for input boxes. and all of them are like this:
Wks2 = InputBox("Enter the name of the worksheet that is to be sent to
the stores")
Again coworker dimed it as a string and it worked on his pc. All the
while I never received an error message when running on my pc.

This is not a pressing question, just a puzzling one for me. All help
is greatly appreciated, and if more information is needed just let me
know.

Thanks



Tsunami3169

Weird Macro Happenings
 
Thanks for the help. I did move the comma and still received the same
error on my coworkers pc.
But without moving the comma and adding Dim wee1 As String my coworker
was able to get the wee1 msgbox to work. But on my pc I don't need the
dim statement.


barnabel

Weird Macro Happenings
 
Check under tools-options editor tab require variable declaration

I would bet that it is checked on the coworker's pc and not on yours. I
personally always dim everything.

Peter Richardson

"Tsunami3169" wrote:

Thanks for the help. I did move the comma and still received the same
error on my coworkers pc.
But without moving the comma and adding Dim wee1 As String my coworker
was able to get the wee1 msgbox to work. But on my pc I don't need the
dim statement.



Tsunami3169

Weird Macro Happenings
 

Thanks Pflugs, I found out that I'm not the only one that's had that
problem. There were references that are located on my pc that ended up
missing when someone else ran it on their pc.


Bill Renaud

Weird Macro Happenings
 
Sometimes not having all computers up-to-date with Office Service
Releases can cause strange behaviors.
Just a thought.
--
Regards,
Bill Renaud





All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com