Thread: "Set" problem
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default "Set" problem

After the error has occured, go into the VBE and make sure your workbook is
the activeproject (selected in the project explorer). Then do
Tools=References (you may need to hit reset first). You should see at least
one reference marked as MISSING. If so, this is the source of your problem
and needs to be removed (if not needed) or fixed by finding the correct
reference.

References are specific to each workbook, so this is consistent with your
assessment that it is associated with the particular workbook.

--
Regards,
Tom Ogilvy


"Ian" wrote:

I have created a number of spreadsheets for use on numerous laptops,
currently running Office 2000. These spreadsheets work fine on my laptop and
previous versions ran OK on all the remote laptops. The latest issue one of
these sheets appears to be causing problems on other systems, but works fine
here.

I've tried this sheet on 2 local PCs (running Office 2k & Office XP) and see
these problems. There are 2 manifestations of what seems to be the same
problem.

Initially an input form runs. This requires certain inputs before the OK
button is enabled. At any stage a Cancel button is available.

1. No inputs are made and the Cancel button is clicked.
The code stops with a compile error stating Can't find project or library.
The code in question is:

With Worksheets("Lookup")
Set Early_8000_23 = .Range("Early_8000_23") '\
End With

There are many other "Set" statements following this, but however many I
comment out, the first one available produces the same error. The section of
the line highlighted is the first "Early_8000_23".

2. All required inputs except one are made and CommandButton3 is clicked.
This should enter the current date into the TextBox2. The code causing
problems is:

Private Sub CommandButton3_Click()
TextBox2.Value = Format(Date, "dd/mm/yyyy")
End Sub

The reference highlighted here is "Date"
CommandButton3 has been clicked as part of the input process and has entered
the current date correctly in TextBox2.

The real questions a
1. Why should this be happening now, when a previous issue of these sheets
worked fine (these particular parts of the code haven't changed)
2. Why should this particular workbook be affected when the others (using
exactly the same Date code and very similar Set statements) work fine.

There's obviously something specific to this workbook, but I can't figure
out what. It would appear that it isn't specifically related to the code
highlighted. I checked the add-ins on my laptop and there aren't any
selected, so that's not the issue.

The only thing I can see is that my laptop is running VB6.5 (Office 2k SP3)
whereas my other Office 2k is only VB6.0 (not even SP1 on this machine) and
Office XP is VB6.3 (SP3). This seems odd as office XP is newer than Office
2000 so I would have thought XP SP3 would have included at least VB6.5.