sujittalukde
04-09-2008, 07:02 AM
I have written a macro which runs well in the where I have made it.
Now when the same file/macro is run on another machine, it is showing an error at three places:
1. Msgbox at Chr13
My code is given below:
MsgBox ("You must have at lease two YES under Column AS titled COMPUTATION REQUIRED to continue for " & _
"Computation of Tax." & Chr$(13) & Chr$(13) _
& "In case you have only one employee, add a dummy employee and put YES to continue " & _
"for computation."), vbInformation, "Two employees!!!!"
The code runs well on the computer where
I have made it but shows an error at the bold Chr$(13)
"Computation of Tax." & Chr$(13) & Chr$(13)
Error is:
Compile error
Can?t find project or Library.
Why this is happening?
2. Error on User Name:
I am using the following code before the WB close event:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Company data").Range("B8").Value = Now
Sheets("Company data").Range("B9").Value = Environ("UserName")
End Sub
Error is coming here:
Environ
Error is:
Compile error
Can?t find project or Library
Why this is happening?
3. I am using the following code to install Analysis Toolpak Add in if not installed:
Sub InstalAddin()
If AddIns("Analysis ToolPak").Installed = False Then
AddIns("Analysis ToolPak").Installed = True
End If
End Sub
How ever while running the file on enabling macro, it showed an error . Then I closed the workbook and opened a new blank Wb and then gone to tools\Addins\ Ticked Analysis Tool Pak. Then the Excel asked ?This feature is not installed on your machine. Would you like to installed it now?
I clicked ?Yes? and then Excel installed the addin and then no error came on opening the workbook?
Why this has happened and how to check this?
Thanks in advance for the valuable advice.
Now when the same file/macro is run on another machine, it is showing an error at three places:
1. Msgbox at Chr13
My code is given below:
MsgBox ("You must have at lease two YES under Column AS titled COMPUTATION REQUIRED to continue for " & _
"Computation of Tax." & Chr$(13) & Chr$(13) _
& "In case you have only one employee, add a dummy employee and put YES to continue " & _
"for computation."), vbInformation, "Two employees!!!!"
The code runs well on the computer where
I have made it but shows an error at the bold Chr$(13)
"Computation of Tax." & Chr$(13) & Chr$(13)
Error is:
Compile error
Can?t find project or Library.
Why this is happening?
2. Error on User Name:
I am using the following code before the WB close event:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Company data").Range("B8").Value = Now
Sheets("Company data").Range("B9").Value = Environ("UserName")
End Sub
Error is coming here:
Environ
Error is:
Compile error
Can?t find project or Library
Why this is happening?
3. I am using the following code to install Analysis Toolpak Add in if not installed:
Sub InstalAddin()
If AddIns("Analysis ToolPak").Installed = False Then
AddIns("Analysis ToolPak").Installed = True
End If
End Sub
How ever while running the file on enabling macro, it showed an error . Then I closed the workbook and opened a new blank Wb and then gone to tools\Addins\ Ticked Analysis Tool Pak. Then the Excel asked ?This feature is not installed on your machine. Would you like to installed it now?
I clicked ?Yes? and then Excel installed the addin and then no error came on opening the workbook?
Why this has happened and how to check this?
Thanks in advance for the valuable advice.