We have a module that checks for machine information for troubleshooting purposes. One of the sub modules checks each reference for breaks. However for a single reference, the Microsoft Office Soap Library 3.0 it halts on an error.
We can work around it, but I'm really interested to know what is causing this error. The reference is valid, not broken. The method of the reference object simply fails for this library.
Method 'FullPath' of object 'Reference' failed
Private Sub getEachRef()
Dim ref As Variant
Dim strRef As String
'On Error Resume Next <- this allows the rest of the code to complete
For Each ref In Application.VBE.ActiveVBProject.References
frmAbout.lst_About.AddItem "[Reference] " & ref.Description
frmAbout.lst_About.List(frmAbout.lst_About.ListCount - 1, 1) = ref.FullPath <- error is here
If ref.IsBroken = True Then
frmAbout.lst_About.List(frmAbout.lst_About.ListCount - 1, 2) = "Broken Link"
End If
Next
End Sub
I run into this posting as I got the same error myself.
I've been able to trace the issue with your problem as follows:
The Error Number returned is: -2147319779
Code compiles without errors
(as mentioned in the posting) The reference is valid, not broken
(meaning that when you check your listed references, the reference(s)
is (are) not Listed as 'Missing' or if checked through VBA, is not listed as 'Broken')
I've read some other postings in other forums where even the code/VBA
application (MsAccess) actually runs without problems in 'one' PC
(PC 01) and returns the 'error' in another PC (PC 02)
I've been able to replicate this phenomena myself.
After comparing PC 01 with PC 02 you see that both PCs though may
actually have the 'same' exact version of MsAccess/Excel installed +
the same MsAccess (or Office) Service Pack installed but once you start to test each and everyone of the applied patches (this can be a
long process), you will find that some Dlls have actually NOT been replaced/patched, updated.
In my case, those affected PCs (that will NOT run the Code, thus produce an error), each had a different cause (different, not properly updated dll), thus there is NOT a 'universal' 'replace the following dlls' to repair the problem.
That said however, there is a solution (so enough of trying to explain):
1st Solution (least invasive)
Repair MsAccess/Office Installation.
When completed, re-apply latest Service Pack + all Office Updates.
This solution in 'some pcs' resolved the issue, ie. VBA Code run without problems.
If Repair MsAccess/Excel/Office Installation failed (due to Error
2424, 2425, or repair fails), then, proceed to solution Nmr. 2 (no
pun intended : D )
2nd Solution (middle group invasive)
Uninstall MsOffice completely (including all updates, Service Packs, etc.)
Will need a clean reboot after the uninstallation has completed.
After the uninstall process has completed and the PC has been rebooted, then install MsOffice again (including all updates, Service Packs, etc.)
This solution actually worked on another sub-set of affected PCs I found.
If uninstall of MsAccess/Excel/Office failed (due to the same
previous Errors 2424, 2425, or repair fails, etc), then, proceed to
solution Nmr. 3 (the nuclear option)
3rd Solution (nuclear option)
Download and Install 'Microsoft Office 2010 FixIt Tool' (or the version that may apply to your situation) https://support.microsoft.com/en-us/office/repair-an-office-application-7821d4b6-7c1d-4205-aa0e-a6b40c5bb88b?ocmsassetid=ha010357402&ctt=1&correlationid=8bfaf910-6d5f-4252-b5bb-0ed67d5d4349&ui=en-us&rs=en-us&ad=us
Run Tool to remove MsOffice 2010 completely. Once completed (PC will
need to be rebooted after the tool is finished with the cleanup/deinstallation)
Reboot PC after MsOffice 2010 (or the version that may apply to your
situation) removal has been completed (this step is very important)
Install MsOffice/MsAccess/Excel 2010 (or the version that may apply to your situation) again.
Install Language Packs (if needed).
Install the latest Service Pack ie. Service Pack 1, Service Pack 2, etc.
This solution actually fixed the 3rd group of affected PCs I had. That said however, after a 'clean' install of MsOffice, some PCs, then got a different error:
Ms Access/Excel Can't Open your previous application.
This error ONLY was found on PCs that had gone through the 3rd Option (though MsOffce and MsAccess 'seem' to work just fine and even the original 'Issue' as described in this posting was 'fixed' meaning that the code run without the Method 'FullPath' of Object Reference failed problem, then the 'new' problem was found as those 'latest' installs of MsOffice (2010 and later) seem to apply updates/service packs differently from commulative updates, vs. clean installs + latest updates/service packs.
4rth Option - Trapping the error
I'm using the same exact code as an example (see above) and insert an 'Error Trapping' Section as follows (I'm copying the entire code and pasting the completed module including the error trapping part):
Private Sub getEachRef()
On Error GoTo getEachRef_Err
Dim ref As Variant
Dim strRef As String
'On Error Resume Next <- this allows the rest of the code to complete
For Each ref In Application.VBE.ActiveVBProject.References
frmAbout.lst_About.AddItem "[Reference] " & ref.Description
frmAbout.lst_About.List(frmAbout.lst_About.ListCount - 1, 1) = ref.FullPath '<- error WAS here
getEachRef_Ressume01:
If ref.IsBroken = True Then
frmAbout.lst_About.List(frmAbout.lst_About.ListCount - 1, 2) = "Broken Link"
End If
Next
getEachRef_Exit:
Exit Sub
getEachRef_Err:
Select Case Err.Number
Case -2147319779
getEachRef_Ressume01
Case Else
MsgBox Err.Number & Err.Description
Resume getEachRef_Exit
End Select
End Sub
This code sample allows the existing code to simply 'jump' over the 'error' and continue :).
In my case, after I had some PCs with Solution No. 1, others with No. 2 and No. 3.. on any new instances, since I implemented the above 'error trapping' into the module, no more errors have been produced anywhere else.
Just to be clear, with solution No. 4, the 'error' is NOT fixed but is simply bypassed and allowed the code to continue to execute the loop.
In my case, I added some more Code into the VBA to show the 'major' version and 'minor' version of the ref.FullPath in the above code that could not be shown (so that at least I can see what was bypassed by the code).
Private Sub getEachRef()
On Error GoTo getEachRef_Err
Dim ref As Variant
Dim strRef As String
For Each ref In Application.VBE.ActiveVBProject.References
frmAbout.lst_About.AddItem "[Reference] " & ref.Description
frmAbout.lst_About.List(frmAbout.lst_About.ListCount - 1, 1) = ref.FullPath '<- error WAS here
getEachRef_Ressume01:
If ref.IsBroken = True Then
frmAbout.lst_About.List(frmAbout.lst_About.ListCount - 1, 2) = "Broken Link"
End If
Next
getEachRef_Exit:
Exit Sub
getEachRef_Err:
Select Case Err.Number
Case -2147319779
getEachRef_Ressume01
Case Else
MsgBox Err.Number & Err.Description
Resume getEachRef_Exit
End Select
End Sub
Related
I have been given the task of converting the slower Macro Express Pro coding for IBM Personal Communications over to a VBScript/VBA version. The Macro Express Pro coding opens a predetermined profile from a specific location.
This process can take up to 30 seconds. VBScript does this in about a third of the time for a default profile (TN3270.WS). However, when we try opening the specific link highlighted in the UNET.txt file, we get this as an error:
Run-time error '440': Automation error
Here is the VBScript code we are trying to use:
Sub Main()
Dim EName
Dim autECLConnList, objConnMgr
Set objConnMgr = CreateObject("Pcomm.autECLConnMgr")
objConnMgr.autECLConnList.Refresh
objConnMgr.StartConnection ("profile='C:\ProgramData\IBM\Personal Communications\UNET REWORK.ws' connname=a")
Application.Wait (Now + TimeValue("00:00:12"))
objConnMgr.autECLConnList.Refresh
EName = objConnMgr.autECLConnList(1).Name
End Sub
The error occurs on the objConnMgr.StartConnection ("profile='C:\ProgramData\IBM\Personal Communications\UNET REWORK.ws' connname=a") line. We know we have the correct path to the profile because it's we found its location:
IBM says that if the profile name contains blanks, it "must to be surrounded by single quotes":
Can anyone provide some advice on what we're doing wrong or what we're missing?
Thanks.
I found a way of doing what I need to do. I was looking too specific into starting a PCOMM session that I didn't even think of just running the .exe file and send it parameters. Here's how I did it:
Sub Main()
Dim WShell
Set WShell = CreateObject("WSCript.shell")
WShell.Run """C:\Program Files (x86)\IBM\Personal Communications\pcsws.exe"" ""C:\ProgramData\IBM\Personal Communications\UNET REWORK.WS"""
End Sub
I'm sure this is a duplicate answer to another question out there, but most of the answers are more than a few years old and outdated. This solution is current and recently tested, so it is a more reliable source.
I have a desktop application written in VB.net that runs a macro in an access. Recently we upgraded from office 2010 to office 365. Now when i run this application i get this error :
Exception that comes up
Error Image
Could not load file or assembly 'Microsoft.Office.Interop.Acces.Dao,Version =15.0.0.0...' or one of its dependencies'
Below is the code that causes the exception:
If _accessApp Is Nothing Then
_accessApp = New Application
End If
Try
If JobFolderPath.Length <= 0 Or JobFolderPath Is Nothing Then
Exit Sub
End If
If _accessApp.CurrentDb() Is Nothing Then
_accessApp.OpenCurrentDatabase(JobFolderPath & "somedb.mdb", False)
_accessApp.Run("SomeProcess")
Else
_accessApp.Run("SomeProcess")
End If
_accessApp.Quit(AcQuitOption.acQuitSaveNone)
Catch ex As Exception
Finally
_accessApp = Nothing
End Try
I even included teh Interop.Access.Dao verion 15 dll in the references for the project. Not sure if this way of running macros is obsolete in access 16. If so, what is the correct way of doing this?
Thanks in advance.
The error also says "or one of its dependencies", install the interop from the link below.
https://www.nuget.org/packages/Microsoft.Office.Interop.Excel/15.0.4795.1000
Click on "Manual Download on the right ...
Not an answer to your question, but a macro can be run without Access references with late binding:
Dim accObj = GetObject(JobFolderPath & "somedb.mdb") ' opens the file if not already open
accObj.Application.Run("SomeProcess") ' the .Application part might not be needed
accObj.Application.Quit(2) ' AcQuitOption.acQuitSaveNone = 2
or command line switches (also not tested):
Process.Start(JobFolderPath & "somedb.mdb" "/x SomeProcess")
Finally i was able to fix it by installing 'microsoft office 16.0 access database engine'(32 bit version) and adding the required dlls as COM references instead of normal dll references.
As a follow-up to a previous post about my VBA/Rhinoscript, I'm running to a really weird "catastrophic" error when I execute the following VBA code from an Excel spreadsheet originally created in Excel 2007 that I'm now trying to run in Excel 2016:
Set Rhino = CreateObject("Rhino4.Interface")
If (Err.Number <> 0) Then
'MsgBox ("Failed to create Rhino4 object")
Set Rhino = CreateObject("Rhino4.Application")
If (Err.Number <> 0) Then
MsgBox "Failed to create Rhino4 object: " & Err.Number
Exit Sub
End If
End If
The CreateObject failing with a Run-time error 8000fff Automation error, Catastrophic failure. Checking around, people have made vague mentions of about migrating between Excel versions being a problem and to look under Tools->References, but I'm not sure exactly what I should be looking for. Does anyone know?
Thanks,
Matt
I am able to make your code work here with Excel 2010 and Rhino 4.0 SR9.
If you are not running Rhino 4.0 SR9, then I suggest you download and install this service release:
http://www.rhino3d.com/download/rhino/4.0/sr
My guess is that Rhino's COM components are not property registered (in the Windows Registry). Installing the latest service release should fix this.
Let me now if this helps.
-- Dale
In VBA I can see three different references for PDFCreator. One of them (see the second image) is a version of the software stored locally, and it works. I'd like to use this reference.
The other two are references to versions stored on a server, and they're broken (at this stage, I don't have permission to reinstall or delete them).
My problem is that after selecting the desired reference (see the second image) and clicking 'Ok', it resets to an incorrect reference, as shown in the third image.
How can I either override whatever's going on and select the desired reference or remove the incorrect references? While I'm not able to uninstall these versions from the server, I see no reason that my Excel would need to reference them. Can they just be removed from the list?
Image 1: Default state of the VBA Project References (PDFCreator not selected)
Image 2: Selecting the correct PDFCreator version
Image 3: Re-opening the menu shows that the incorrect PDFCreator version is selected
You might be able to something like the following...
To Remove broken references:
Private Sub RemoveBrokenReferences(ByVal Book As Workbook)
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Dim oRefS As Object, oRef As Object
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Set oRefS = Book.VBProject.References
For Each oRef In oRefS
If oRef.IsBroken Then
Call oRefS.Remove(oRef)
End If
Next
End Sub
To Remove a specific reference:
Use something like:
Call ActiveWorkbook.VBProject.References.Remove(oReference)
and you can get the oReference from:
Private Function GetReferenceFromPath(ByVal FilePathName As String) As Object
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Dim oFs As Object, oReferenceS As Object, oReference As Object
Dim sFileName As String, sRefFileName As String
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Set oFs = Interaction.CreateObject("Scripting.FileSystemObject")
sFileName = oFs.GetFileName(FilePathName)
Set oReferenceS = ActiveWorkbook.VBProject.References
For Each oReference In oReferenceS
sRefFileName = oFs.GetFileName(oReference.FullPath)
If StrComp(sFileName, sRefFileName, vbTextCompare) = 0 Then
Set GetReferenceFromPath = oReference
End If
Next
End Function
Public Sub RemoveReference()
On Error GoTo EH
Dim RefName As String
Dim ref As Reference
RefName = "Selenium"
Set ref = ThisWorkbook.VBProject.References(RefName)
ThisWorkbook.VBProject.References.Remove ref
Exit Sub
EH:
'If an error was encountered, inform the user
Select Case Err.Number
Case Is = 9
MsgBox "The reference is already removed"
Exit Sub
Case Is = 1004
MsgBox "You probably do not have to have Trust Access To Visual Basic Project checked or macros enabled"
Exit Sub
Case Else
'An unknown error was encountered
MsgBox "Error in 'RemoveReference'" & vbCrLf & vbCrLf & Err.Description
End Select
End Sub
P.S It is not possible to remove A MISSING/ broken references programmatically after MISSING occurs, only before it happens or manually after it happens. Most cases of MISSING/ broken references are caused because the type library has never before been registered on that system.
See How to Remove Reference programmatically?
I had a broken reference problem with a large number of Excel spreadsheets when I uninstalled Flash (which for some unknown reason I had included as a reference).
I got round the problem as follows:
BE CAREFUL BECAUSE THIS INVOLVES A REGISTRY HACK AN IS COMPLICATED.
MAKE A BACKUP OF REGISTRY BEFORE HACKING.
I wrote VBA code to find the Guid of the broken reference.
I used Regedit to insert a DUMMY TypeLib entry as follows:
D27CDB6B-AE6D-11CF-96B8-444553540000 was the Guid of the Broken Reference.
HKEY_CLASSES_ROOT\TypeLib{D27CDB6B-AE6D-11CF-96B8-444553540000}
HKEY_CLASSES_ROOT\TypeLib{D27CDB6B-AE6D-11CF-96B8-444553540000}\1.0 Adobe Acrobat 7.0 Browser Control Type Library 1.0
HKEY_CLASSES_ROOT\TypeLib{D27CDB6B-AE6D-11CF-96B8-444553540000}\1.0\0
HKEY_CLASSES_ROOT\TypeLib{D27CDB6B-AE6D-11CF-96B8-444553540000}\1.0\0\win32 C:\Program Files (x86)\Common Files\Adobe\Acrobat\ActiveX\AcroPDF.dll
HKEY_CLASSES_ROOT\TypeLib{D27CDB6B-AE6D-11CF-96B8-444553540000}\1.0\FLAGS 0
HKEY_CLASSES_ROOT\TypeLib{D27CDB6B-AE6D-11CF-96B8-444553540000}\1.0\HELPDIR C:\Program Files (x86)\Common Files\Adobe\Acrobat\ActiveX\
I based the above on another TypeLib entry.
Then I wrote VBA code to read each Reference.Guid in turn and if the Guid matched {D27CDB6B-AE6D-11CF-96B8-444553540000} to remove the reference using References.Remove Reference.
Code for doing this is available all over the forums so I won't repeat here.
After modifying all the affected Workbooks I reinstated the saved registry.
Hope this works for you.
BE CAREFUL BECAUSE THIS INVOLVES A REGISTRY HACK AN IS COMPLICATED.
MAKE A BACKUP OF REGISTRY BEFORE HACKING.
My customer is getting a Compile Error; Can't find project or Library on his version of Excel 2010, however i am not getting this on my version of 2010. How can i adjust this code so it will not appear. When the error appears in the following code the text "cell" in "For each cell in selection" is highlighted:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$9" Then
Columns("D:CB").Select
Selection.EntireColumn.Hidden = False
Application.ScreenUpdating = False
Sheet17.Range("E48:CB48").Select
For Each cell In Selection
If cell = 0 Then
Range(cell.Address).EntireColumn.Hidden = True
End If
Next
Application.ScreenUpdating = True
Sheet17.Range("b9").Select
End If
End Sub`
My customer is also reporting a bug in the following code with the word "Response" being highlighted. This, as well, is not an issue for me, on my version of Excel 2010. Any and all help is greatly appreciated.
If Sheet1.Range("E18") = 3 Then
Response = MsgBox("Reminder Emails have been set to be sent automatically at " & Sheet1.Range("f18").Value & ", " & Sheet1.Range("Q4").Value & " day(s) before" & vbCrLf & "the scheduled appointment. Do you want to send reminder e-mails now anyway?", vbYesNo)
If Response = vbNo Then
Exit Sub
End If
End If
In the VBA window, go to Tools --> References and ensure the same libraries are toggled on for all computers. Also make sure all active libraries are in the same order top-to-bottom.
Many libraries "come standard" but one may need to be toggled on. Or, a library reference may need to be toggled off due to a functional interference. A library may be altogether missing, but I doubt this is the case since it's a fairly standard suite and you aren't aware of having tinkered with it.
This is a typical issue and usually not considered too great a burden on your distribution clientele. If it is, you can rework your code to use fewer references; or you may be able to load the needed libraries programmatically (but I haven't ever tried that).
I suggest you include Option Explicit at the top of all modules. This problem looks a bit like a failure to declare your variables; and I think that requirement can vary by setting. Option Explicit will force all variables to be declared, which is beneficial in general and could cause all client installs to act the same.