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