Log in

View Full Version : Could not load some objects...



johnny6
06-07-2012, 03:47 AM
Hello all,

I have a Word document (MS Office 2007) with some VBA behind it that loads a userform when run, takes input from the user, and returns a formatted document.

I recently moved the document from a Windows XP machines where it works fine to a Windows 7 machine (with the same version of Office) and now when I run it I get the error message:


Could not load some objects because they are not available on this machine.


Debug takes me to the autonew() Sub routine:

Sub autonew()
'
'
UserForm1.Show
End Sub

With UserForm1.Show highlighted.

Searching the internet I have found a couple possible causes. One being that some controls are not in plays on the Windows 7 machine. I checked the controls checked in the "Additional Controls" Toolbox option and they are the same on both machines. The listed DLL that they use (C:\WINDOWS\system32\FM20.DLL) is also in place on both machines.

I also read that the reference libraries might not be the same on both machines. I verified that, in the VBA editor under Tools -> References, all of the same references were selected on both machines.

I read about registering the DLLs with the operating system by using the REGSVR32 command but I do not have admin access on the computers so I will need to get someone else to help me with that.

If anyone has any information that might help me, I would appreciate it. I spoke to an admin briefly yesterday and he said it sounded like some piece of software that is needed wasn't put onto the Windows 7 machine but we are not sure what that software might be.

Thanks for your time!

Tinbendr
06-07-2012, 03:54 AM
Use F8 to see if you can step through the code any further. Sometimes Word will 'back up' to a object's entry point long before the error occurs.

Good luck!

johnny6
06-07-2012, 04:13 AM
Thanks for the response! F8 takes me to
Private Sub UserForm_Initialize()
and then stops at each of the .AddItems under that for list boxes.

I don't know if this means anything, but F8 stops at each item under that Sub routine up until a certain point and then it starts over. I am not sure why it just stops at one (maybe it's random?) and skips the rest.

There are two Date Time Picker calendars on the userform and where the F8 stops is on the first dtp .Value but then it skips the 2nd one.


dtpDate1.Value = Now()
dtpDate2.Value = Now()


Thanks again.

Tinbendr
06-07-2012, 04:31 AM
I did a quick search on Datepicker and Win7 and found quite a few discrepancies. M$ can't seem to make up it's mind about a stable calendar control that works across all versions of Office and OS's.

Here's a link to a solution (https://sites.google.com/site/e90e50/calendar-control-class) they claim works in all versions.

johnny6
06-07-2012, 04:55 AM
Well it definitely seems like dtp is the culprit. I removed all the calendar and date stuff from the code and it runs fine.

This is going to be a pain...

I appreciate the help; you really saved me a lot of troubleshooting time.