rvrajendra
03-19-2012, 02:41 AM
Hi
I have a macro developed in excel 2010. The macro contains left,right,dir functions.
When I run in 2010 its fine, but the same macro when run in excel 2007. I am getting compile error
Complie error: Cant find project or library.
Please let me know what reference I need to add.
Bob Phillips
03-19-2012, 03:38 AM
Same old mantra: show us the code!
DannyBOHLEN
03-27-2012, 11:38 AM
Some problem, but 2010 (*.xls) -> 2003 (with red):
1.
Application.StatusBar = "Any text" & " | " & Date & " | " & Time & " | "
2.
Worksheets(ActiveSheet.Name).Cells(2, 2).Value = (Format(Worksheets("DOCS").Cells(1, 2).Value, "dd.mm.yyyy"))
3.
Function ReturnComputerName() As String
Dim rString As String * 255, sLen As Long, tString As String
tString = ""
On Error Resume Next
sLen = GetComputerName(rString, 255)
sLen = InStr(1, rString, Chr(0))
If sLen > 0 Then
tString = Left(rString, sLen - 1)
Else
tString = rString
End If
On Error GoTo 0
ReturnComputerName = Trim(tString)
End Function
4.
Function DimensiuneMonitor() As String
Dim w As Long, h As Long
w = GetSystemMetrics32(0) ' width in points
h = GetSystemMetrics32(1) ' height in points
''MsgBox Format(w, "#,##0") & " x " & Format(h, "#,##0"), vbInformation, "Monitor Size (width x height)"
DimensiuneMonitor = Format(w, "#,##0") & " x " & Format(h, "#,##0")
End Function
5.
Function HDSerialNumber() As String
Dim fsObj As Object
Dim drv As Object
Dim strSerial As String
Set fsObj = CreateObject("Scripting.FileSystemObject")
'Set drv = fsObj.Drives("C")
Set drv = fsObj.GetDrive("C:\")
HDSerialNumber = Left(Hex(drv.SerialNumber), 4) & "-" & Right(Hex(drv.SerialNumber), 4)
'MsgBox HDSerialNumber
End function
6.
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function Utilizator() As String
Dim rString As String * 255, sLen As Long, tString As String
tString = ""
On Error Resume Next
sLen = GetUserName(rString, 255)
sLen = InStr(1, rString, Chr(0))
If sLen > 0 Then
tString = Left(rString, sLen - 1)
Else
tString = rString
End If
On Error GoTo 0
Utilizator = Trim(tString)
End Function
:(
CatDaddy
03-27-2012, 11:58 AM
libraries should be marked "missing" in Visual Basic >> Tools >> References
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.