Weird Macro Happenings

T

Tsunami3169

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
 
P

Pflugs

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
 
T

Tsunami3169

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.
 
B

barnabel

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
 
T

Tsunami3169

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.
 
B

Bill Renaud

Sometimes not having all computers up-to-date with Office Service
Releases can cause strange behaviors.
Just a thought.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top