Hi Robert
First, how and when is this code running? If you put a break on the first
line of the code, and then run your form, does your code actually run?
Second, this code
Set db = OpenDatabase("C:\Work\Schools.xls", False, False, "Excel 11.0")
should be
Set db = OpenDatabase("C:\Work\Schools.xls", False, False, "Excel 8.0")
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> Shauna,
>
[quoted text clipped - 83 lines]
>> >
>> > Any ideas?
Robert_L_Ross - 31 Jul 2007 16:52 GMT
Shauna,
Well, this is all in a document template. I have a module1 that I have this
code in:
Sub autonew()
UserForm1.Show
End Sub
As for putting a breakpoint...I'm not fully following. I can manually run
the code with a breakpoint at the "Set db = opendatabase("C:\Documents and
Settings\RRoss\Desktop\TESTSOURCE.xls", False, False, "Excel 8.0")" line, no
earlier.
The form appears when I open a new document based on the template, but the
field is blank. No errors or anything either.
As for the Excel version...does it matter that I'm actually running Excel 10?
Thanks in advance!!
> Hi Robert
>
[quoted text clipped - 98 lines]
> >> >
> >> > Any ideas?
Shauna Kelly - 03 Aug 2007 11:11 GMT
Hi Robert
1. The code must be the following, regardless of whether you're using Excel
10.0 or 11.0 (I confess I haven't tried it with 12):
Set db = OpenDatabase("C:\Work\Schools.xls", False, False, "Excel 8.0")
2. Your routine is named SchoolForm_Initialize(). That's an odd kind of name
for a Sub. Not wrong; just odd. Are you explicitly calling this routine?
That is, somewhere in, say, the UserForm_Initialize Sub do you explcitly
call SchoolForm_Initialize? The purpose of setting a break point is to run
the code and allow the code to stop at your break point. If it stops in the
middle of your routine, you know the routine is running. If you set a break
point in SchoolForm_Initialize and the code does not stop, then you know
that SchoolForm_Initialize is not, in fact, running at all. And that would
explain why the list box is empty. I suspect that SchoolForm_Initialize
isn't running at all.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> Shauna,
>
[quoted text clipped - 127 lines]
>> >> >
>> >> > Any ideas?