The use of VBA function "Time" in an Excel Macro

M

MC

Hi,
I've been using a Macro in Excel to calculate certain averages that uses the
function "Time" from VBA libraries. When trying to run the same Macro in
another computer with the same version of Excel (Excel 2003 (11.5612.5606)),
I get the compile error messasge: "Can't find project or library" and
highlights the term "Time". It looks as if that function "Time" is in a
library that this version of excel has no access to. Is there anyway to
"solve" this?
Thanks for any suggestion,
MC
 
C

Conan Kelly

MC,

Check the Add-Ins in XL on your computer and make sure the troublesome
computer has the same add-ins enabled.

HTH,

Conan Kelly
 
M

MC

Thanks Conan,
will check ... any suggestion as to which add-in would include such "Time"
function frm VBA???
thanks
MC
 
C

Conan Kelly

MC,

I don't know much about the add-ins that come with XL, but looking at my
list, there are 2 with VBA in the title: Analysis ToolPak - VBA and
Internet Assistant VBA.

Just geussing, but I don't think Internet Assistant VBA would have it.

Do you have either of those 2 add-ins enabled on your computer? Does the
problematic computer have them enabled?

If they are not listed, they will probably need to be installed.

HTH,

Conan
 
R

royUK

Check in the VB Editor Tools menu -> References, uncheck any that are
marked missing. Then try again
 
M

MC

Hi Conan, thanks for your suggestion but I have both the analysis toolpak and
analysis toolpak - VBA add-ins installed and I'm still getting the same error
which also comes out with the function format() of VB.

I avoided the use of the time function substituting this

= Format(Time, "hh:mm:ss AMPM")

by this:

With .Cells(1, 5)
.Formula = "=now()"
.NumberFormat = "hh:mm:ss;@"
End With

but then I'm getting the same error with the use of format in this function
(thisone I don't know how to avoid...)

Public Function F(r As Variant, i As Integer) As Variant
r = Value(r, (DemB))
If i = 4 Then
F = Format(r, "###0.0000")
Else: F = Format(r, "###0.00")
End If
End Function

I also checked in the folder "program files\common files\Microsoft
shared\VBA\VBA6" and there are a bunch of DLLs, apparently no one has the
functions mentioned above or Excel isn't getting access to them...
 
M

MC

Thanks royUK, I tried to follow your sugg but the option Reference in VB
Editor Tools Menu appears disabled. No idea why...
 
R

royUK

The References option should display a list of References to select or
deselect. It should be availble for the active workbook. make sure that
you have the workbook selected in the Projects window of the VB Editor.
 
R

royUK

Glad that helped, it is often helpfull to see the file - you might like
to cosider the information bellow

HOW TO GET FURTHER HELP WITH A WORKBOOK
For further help with it why not join our forums (shown in
the link below) it's completely free, if you do join you will have the
opportunity to add attachmnets to your posts so you can add workbooks to
better illustrate your problems and get help directly with them. Also if
you do join please post in this thread (link found below) so that people
who have been following or helping with this query can continue to do
so. :)
 

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