"compile error in hidden module: ThisWorkbook" for Excel 2002 - pls check this code !

M

Marie J-son

Hi,

I have developed code in excel 2003 and it work ok in excel XP. Now, when
trying in excel 2002 i get "compile error in hidden module: ThisWorkbook"
when I start upp the file. I haven't the version and can't test it (yet).
Problelm has occured two times, both without MS 2002 SP2 and with it.

Can any of you see where I should start to look at now, before I have the
excel version myself? Here is the code in that module that is active at
startup and probl. contain error causing code. (the code is cleaned from
usual stuff like EnableEvents = False etc.):


Private Sub Workbook_Open()
'************************
frmIntro.Show
Unload frmIntro
Call TimeLimit
Exit Sub

'CODE IN 'frmIntro'
Private Sub UserForm_Activate()
'*************************
DoEvents
Call IntroSub
Unload frmIntro
End Sub
'NOTE: frmIntro contain just two bitmap images and a textbox

Sub TimeLimit()
'Start 30 days demo countdown
'****************************
Debug.Print "SUB TimeLimit started"
Dim dateStart As Date
Dim daysAllow As Long
Dim daysLeft As Long
Dim daysPassed As Long

' Make a "cell GUI" (hidden cell) for allowed days to test XL file
daysAllow = Sheet1.Range("S21").Cells.Value

If Sheet1.Range("S20").Cells.Value = "" Then
dateStart = Now
Sheet1.Range("S20").Cells.Value = dateStart
End If

' Calculate days left
If Sheet1.Range("S20").Cells.Value <> "" Then
daysPassed = DateDiff("d", Sheet1.Range("S20").Cells.Value, Now)
Debug.Print "DaysPassed: " & daysPassed & " and daysAllowed :" &
daysAllow

If daysPassed < daysAllow Then
daysLeft = daysAllow - daysPassed
MsgBox "humber rumbel aaa bbb" & _
"xsdx" & daysLeft & " xsxsxsx."

ElseIf daysPassed >= daysAllow Then
MsgBox "xxx yyy zzz- " & Chr(10) & _
"aaa bbb ccc." & Chr(10) & _
Chr(10) & "More information are found at http://www.aaaa.com "
ActiveWorkbook.Close SaveChanges:=False
Exit Sub
End If
End If
End Sub

Sub IntroSub()
'***********************
ActiveWorkbook.Colors(36) = RGB(255, 255, 204)
ActiveWorkbook.Colors(40) = RGB(234, 234, 234)
ActiveWorkbook.Colors(8) = RGB(235, 255, 255)
ActiveWorkbook.Colors(43) = RGB(51, 153, 51)
End Sub

/regards
 
H

Hayeso

The problem is with references.
In the VB Editor
1. select the project.
2. Select Tools...References

You will see one or more references with the word MISSING showing.

Most times this is because the 2003 reference is not present on the 2002
machine and can be got around by referencing the 2002 equivalent instead.

Otherwise, you can select the referenmce on the 2003 machine. You will see
information including the file name in the bottom of the References dialog.

Copy this file to the 2002 machine and restart your project
 
M

Marie J-son

Hi, thanks for rapid answer.

Can you expalin a bit more, I don't follow you when talking about possible
solutions? This is a file that is used by other people and I have no
possibility to change things on their pc:s. I need to find what is the cause
and find a workaround that work for all excel 2000 to 2003, or have to take
away the feature...
You scould see the code yourself, what causes the reference problem, do you
think?

/Regards
 
M

Marie J-son

Hi,

yes, that came when I washed the code for you to more easily see it. All my
debug.print's and errorhandlers would make you dizzy othervice:)

/regards
 
M

Marie J-son

How does it work? You are right that it say it miss word 11.0 object
library. How can I get rid of that? can I somehow insatll other librarys and
define them instead - office 2000 or something? Wher can I find it and how
do I do?

I tried earlier with a word integration, but doesn't anymore. Can I just
uncheck this word 11 library?

Regards
 
R

Rob van Gelder

To follow on...

From the Debug menu select Compile <VBAProject> (where <VBAProject> is the
name of your project).
It should give you compile errors about Word (constants, objects, etc...).

If it compiles without error, then that is a good indicator there is nothing
lingering to be concerned about.
 

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