"Could not locate some objects...."

  • Thread starter Thread starter inquirer
  • Start date Start date
I

inquirer

I have transferred some vba code form a desktop running excel 2002 to a new
laptop running excel 2003 and when I run one of the forms I get the error
message "Could not load some objects because they are not available on this
machine"
I have checked the Tools/ References and they are both the same on each
machine.
Could someone tell me what is missing please and how do I find it?
Thanks Chris
 
Further to my enquiry, I think the problem is a "Commondialog" control. I
originally got this from a website but have since mislaid the reference. I
recall I had to set a additonal control to Toolbox/Controls but can't
remember how. Perhaps someone knows of the website and could point me to it?

The code which works fine on the desktop pc (excel 2002) is :
Private Sub CommandButton1_Click()
bOK = True
Me.Hide
End Sub
Private Sub CommandButton2_Click()
bOK = False
Unload Me
End
End Sub
Private Sub CommonDialog2_Enter()

End Sub
Private Sub UserForm_Initialize()
Dim d1 As String
d1 = CurDir
TextBox26.Value = d1
ChDir d1
End Sub
Private Sub chngDir_Click()
Dim sMyNewDirectory As String
Dim stempdir As String
dirSelect.Show
stempdir = CurDir
On Error Resume Next
CommonDialog2.DialogTitle = "BROWSE to the datafile directory, double
click on it and press SAVE"
CommonDialog2.InitDir = app.path
CommonDialog2.Filename = "DOUBLE CLICK on directory then press SAVE"
CommonDialog2.flags = cdlOFNNoValidate + cdlOFNHideReadOnly
CommonDialog2.Filter = "Directories|*.~~~"
CommonDialog2.CancelError = True
CommonDialog2.ShowSave
If Err <> 32755 Then
sMyNewDirectory = CurDir
End If
ChDir stempdir
TextBox26.Value = sMyNewDirectory
End Sub
Private Sub GetstkFile()
CommonDialog1.InitDir = TextBox26.Value & "\"
CommonDialog1.DialogTitle = "Saved file name"
CommonDialog1.Filter = "File name (*.xls)|*.xls"
CommonDialog1.DefaultExt = ".xls"
CommonDialog1.ShowOpen
TextBox25.Value = CommonDialog1.Filename
End Sub
Private Sub browseSF_Click()
GetstkFile
End Sub
Private Sub dirSelect_Click()

End Sub


Thanks
Chris
 
inquirer said:
I have transferred some vba code form a desktop running excel 2002 to a new
laptop running excel 2003 and when I run one of the forms I get the error
message "Could not load some objects because they are not available on this
machine"
I have checked the Tools/ References and they are both the same on each
machine.
Could someone tell me what is missing please and how do I find it?
Thanks Chris

I'd be sure that there is a problem locating the source for a control which
could be stored in a .OCX file such as MSCOMCT2.OCX. If the library is
present on your laptop, it could be that it needs registering with REGSVR32.
At a command prompt, type something like REGSVR32 MSCOMCT2.OCX.
 
I think the problem is that on my desktop I have VB loaded but it is not on
the laptop.

So is it possible to identify the OCX? that is required and copy it to the
laptop and then register it? Or is there more to it than that?

Thanks
Chris
 
inquirer said:
I think the problem is that on my desktop I have VB loaded but it is not on
the laptop.

So is it possible to identify the OCX? that is required and copy it to the
laptop and then register it? Or is there more to it than that?
I use the date picker which is contained in MSCOMCT2.OCX so if you know that
there is a control on a user form which is not part of the "normal" set of
controls, you can find the library name as follows:-

In the VB editor, click on View>Toolbox. Then, right click on a blank part
of the toolbox and select Additional Tools. You will next see a dialog
containing a list of available controls and the library file is shown when
you click on the descriptions (some are .dll, some .ocx). Check which ones
you have on the desktop and make those libraries available on your laptop.
Then register them, if necessary.

HTH
 
I have done that and the additional tools that are checked are identical on
both systems. Looks as tho I'll have to fins another way round this.
Chris
 

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

Back
Top