PC Review


Reply
Thread Tools Rate Thread

Code looping through files

 
 
Otto Moehrbach
Guest
Posts: n/a
 
      31st Dec 2006
Excel XP & Win XP
I'm helping an OP with a project. The code loops through all the files in a
folder, opens each, does things, closes the file and opens the next file,
etc.
The code is placed in the Personal.xls file. It works fine for me. It
fails on opening the first file for him (will not open the file). An error
is produced saying that opening the file failed. He has Excel 2003.
He sent me his Personal.xls file. I changed the name and put it in my
XLSTART folder. It works fine with my path. I created his path on my
computer and that works fine too.
I checked the VBE - Tools - References. The only thing I have checked that
he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
anything like that to check.
Does anyone have any ideas of what I could do? Thanks for your time. Otto


 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      31st Dec 2006
It is suspicious that opening is the problem.

Make sure that the Security settings for Excel are the same on both machines.
--
Gary's Student


"Otto Moehrbach" wrote:

> Excel XP & Win XP
> I'm helping an OP with a project. The code loops through all the files in a
> folder, opens each, does things, closes the file and opens the next file,
> etc.
> The code is placed in the Personal.xls file. It works fine for me. It
> fails on opening the first file for him (will not open the file). An error
> is produced saying that opening the file failed. He has Excel 2003.
> He sent me his Personal.xls file. I changed the name and put it in my
> XLSTART folder. It works fine with my path. I created his path on my
> computer and that works fine too.
> I checked the VBE - Tools - References. The only thing I have checked that
> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
> anything like that to check.
> Does anyone have any ideas of what I could do? Thanks for your time. Otto
>
>
>

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      31st Dec 2006
Do you know the exact wording of the error message? Is it coming from Excel
or from VBA?

> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
> anything like that to check.


That's a big clue. Does he really not have the Forms library listed in the
References list box? Even if it not checked, it should be present in the
list. MSFORMS is part of the basic Excel installation, not optional in any
way. If "Microsoft Forms 2.0 Object Library" doesn't appear at all in the
References list, the basic installation of Excel is bad.

The first thing I'd advise to your user is to unregister and re-register
Excel. Close Excel (and all other Office programs), go to the Windows Start
menu, choose Run and enter

RegSvr32 "Excel.exe" /unregserver

The repeat the process with

RegSvr32 "Excel.exe" /regserver

You may have to use the full file path of Excel instead of just "Excel.exe".
In the Immediate window of VBA, enter the following and press Enter.

?Application.Path & "\Excel.exe"

This will display the full pathname of Excel.exe. Use that filename in
place of "Excel.exe" in the RegSvr32 commands.

Now try to open the workbook. In VBA, ensure that "Microsoft Forms 2.0
Object Library" appears in the list of references. Try adding a UserForm to
the project. Doing so will automatically add a reference to MSFORMS.

If this fails, and you (by which I mean your user) get an error message
when trying to add a UserForm, try to add the reference to MSFORMS manually.
In the References dialog, click "Browse" and navigate to the file

C:\WINDOWS\system32\FM20.DLL

If you find the file, click OK or Open. If you don't find the file, then
you'll probably want to run "Detect And Repair" from the Help menu. If this
doesn't fix the problem, you'll likely need to uninstall and reinstall
Office.

A missing MSFORMS reference item and/or a missing FM20.DLL file indicates
that something serious has gone on.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)




"Otto Moehrbach" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Excel XP & Win XP
> I'm helping an OP with a project. The code loops through all the files in
> a folder, opens each, does things, closes the file and opens the next
> file, etc.
> The code is placed in the Personal.xls file. It works fine for me. It
> fails on opening the first file for him (will not open the file). An
> error is produced saying that opening the file failed. He has Excel 2003.
> He sent me his Personal.xls file. I changed the name and put it in my
> XLSTART folder. It works fine with my path. I created his path on my
> computer and that works fine too.
> I checked the VBE - Tools - References. The only thing I have checked
> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
> anything like that to check.
> Does anyone have any ideas of what I could do? Thanks for your time.
> Otto
>
>



 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      31st Dec 2006
Since you don't show the code, have him send you the file that fails to open
and test the code with that file. Perhaps the file is damaged or not a file
Excel will open.

--
Regards,
Tom Ogilvy

"Otto Moehrbach" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Excel XP & Win XP
> I'm helping an OP with a project. The code loops through all the files in
> a folder, opens each, does things, closes the file and opens the next
> file, etc.
> The code is placed in the Personal.xls file. It works fine for me. It
> fails on opening the first file for him (will not open the file). An
> error is produced saying that opening the file failed. He has Excel 2003.
> He sent me his Personal.xls file. I changed the name and put it in my
> XLSTART folder. It works fine with my path. I created his path on my
> computer and that works fine too.
> I checked the VBE - Tools - References. The only thing I have checked
> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
> anything like that to check.
> Does anyone have any ideas of what I could do? Thanks for your time.
> Otto
>
>



 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      31st Dec 2006
You might ask if the OP is able to use controls from the control toolbox
toolbar in Excel.

If he can, then he might not be giving you correct information on the
Microsoft Forms 2.0 Object library being available to select.

--
Regards,
Tom Ogilvy


"Chip Pearson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Do you know the exact wording of the error message? Is it coming from
> Excel or from VBA?
>
>> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
>> anything like that to check.

>
> That's a big clue. Does he really not have the Forms library listed in
> the References list box? Even if it not checked, it should be present in
> the list. MSFORMS is part of the basic Excel installation, not optional in
> any way. If "Microsoft Forms 2.0 Object Library" doesn't appear at all in
> the References list, the basic installation of Excel is bad.
>
> The first thing I'd advise to your user is to unregister and re-register
> Excel. Close Excel (and all other Office programs), go to the Windows
> Start menu, choose Run and enter
>
> RegSvr32 "Excel.exe" /unregserver
>
> The repeat the process with
>
> RegSvr32 "Excel.exe" /regserver
>
> You may have to use the full file path of Excel instead of just
> "Excel.exe". In the Immediate window of VBA, enter the following and press
> Enter.
>
> ?Application.Path & "\Excel.exe"
>
> This will display the full pathname of Excel.exe. Use that filename in
> place of "Excel.exe" in the RegSvr32 commands.
>
> Now try to open the workbook. In VBA, ensure that "Microsoft Forms 2.0
> Object Library" appears in the list of references. Try adding a UserForm
> to the project. Doing so will automatically add a reference to MSFORMS.
>
> If this fails, and you (by which I mean your user) get an error message
> when trying to add a UserForm, try to add the reference to MSFORMS
> manually. In the References dialog, click "Browse" and navigate to the
> file
>
> C:\WINDOWS\system32\FM20.DLL
>
> If you find the file, click OK or Open. If you don't find the file, then
> you'll probably want to run "Detect And Repair" from the Help menu. If
> this doesn't fix the problem, you'll likely need to uninstall and
> reinstall Office.
>
> A missing MSFORMS reference item and/or a missing FM20.DLL file indicates
> that something serious has gone on.
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email address is on the web site)
>
>
>
>
> "Otto Moehrbach" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Excel XP & Win XP
>> I'm helping an OP with a project. The code loops through all the files
>> in a folder, opens each, does things, closes the file and opens the next
>> file, etc.
>> The code is placed in the Personal.xls file. It works fine for me. It
>> fails on opening the first file for him (will not open the file). An
>> error is produced saying that opening the file failed. He has Excel
>> 2003.
>> He sent me his Personal.xls file. I changed the name and put it in my
>> XLSTART folder. It works fine with my path. I created his path on my
>> computer and that works fine too.
>> I checked the VBE - Tools - References. The only thing I have checked
>> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
>> anything like that to check.
>> Does anyone have any ideas of what I could do? Thanks for your time.
>> Otto
>>
>>

>
>



 
Reply With Quote
 
rjr
Guest
Posts: n/a
 
      1st Jan 2007
Hi, I've got the problem that Otto is helping me with. I've done a complete
detect and repair and as Chip has suggested I've looked in the References
List box and I do have Microsoft Forms 2.0 Object Library installed and
checked. I also have the FM20.dll installed and visible. I also attempted to
include a user form and it was installed without a hitch, absolutely no
problem.

I did send the file to Otto and he can't recreate the problem. The code
performs as it should on his machine and completes. I still get the error
and the code stops, as Otto has said. Is there anything that anyone can
think of that I can do that he and I haven't. If uninstalling and
reinstalling Excel would work I could do that also.

Thanks Bob Reynolds

"Chip Pearson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Do you know the exact wording of the error message? Is it coming from
> Excel or from VBA?
>
>> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
>> anything like that to check.

>
> That's a big clue. Does he really not have the Forms library listed in
> the References list box? Even if it not checked, it should be present in
> the list. MSFORMS is part of the basic Excel installation, not optional in
> any way. If "Microsoft Forms 2.0 Object Library" doesn't appear at all in
> the References list, the basic installation of Excel is bad.
>
> The first thing I'd advise to your user is to unregister and re-register
> Excel. Close Excel (and all other Office programs), go to the Windows
> Start menu, choose Run and enter
>
> RegSvr32 "Excel.exe" /unregserver
>
> The repeat the process with
>
> RegSvr32 "Excel.exe" /regserver
>
> You may have to use the full file path of Excel instead of just
> "Excel.exe". In the Immediate window of VBA, enter the following and press
> Enter.
>
> ?Application.Path & "\Excel.exe"
>
> This will display the full pathname of Excel.exe. Use that filename in
> place of "Excel.exe" in the RegSvr32 commands.
>
> Now try to open the workbook. In VBA, ensure that "Microsoft Forms 2.0
> Object Library" appears in the list of references. Try adding a UserForm
> to the project. Doing so will automatically add a reference to MSFORMS.
>
> If this fails, and you (by which I mean your user) get an error message
> when trying to add a UserForm, try to add the reference to MSFORMS
> manually. In the References dialog, click "Browse" and navigate to the
> file
>
> C:\WINDOWS\system32\FM20.DLL
>
> If you find the file, click OK or Open. If you don't find the file, then
> you'll probably want to run "Detect And Repair" from the Help menu. If
> this doesn't fix the problem, you'll likely need to uninstall and
> reinstall Office.
>
> A missing MSFORMS reference item and/or a missing FM20.DLL file indicates
> that something serious has gone on.
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
> (email address is on the web site)
>
>
>
>
> "Otto Moehrbach" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Excel XP & Win XP
>> I'm helping an OP with a project. The code loops through all the files
>> in a folder, opens each, does things, closes the file and opens the next
>> file, etc.
>> The code is placed in the Personal.xls file. It works fine for me. It
>> fails on opening the first file for him (will not open the file). An
>> error is produced saying that opening the file failed. He has Excel
>> 2003.
>> He sent me his Personal.xls file. I changed the name and put it in my
>> XLSTART folder. It works fine with my path. I created his path on my
>> computer and that works fine too.
>> I checked the VBE - Tools - References. The only thing I have checked
>> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
>> anything like that to check.
>> Does anyone have any ideas of what I could do? Thanks for your time.
>> Otto
>>
>>

>
>



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Jan 2007
What's the error that is displayed?

Any chance that Otto has access to that folder and you don't?

Can you open the file just via File|Open?

rjr wrote:
>
> Hi, I've got the problem that Otto is helping me with. I've done a complete
> detect and repair and as Chip has suggested I've looked in the References
> List box and I do have Microsoft Forms 2.0 Object Library installed and
> checked. I also have the FM20.dll installed and visible. I also attempted to
> include a user form and it was installed without a hitch, absolutely no
> problem.
>
> I did send the file to Otto and he can't recreate the problem. The code
> performs as it should on his machine and completes. I still get the error
> and the code stops, as Otto has said. Is there anything that anyone can
> think of that I can do that he and I haven't. If uninstalling and
> reinstalling Excel would work I could do that also.
>
> Thanks Bob Reynolds
>
> "Chip Pearson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Do you know the exact wording of the error message? Is it coming from
> > Excel or from VBA?
> >
> >> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
> >> anything like that to check.

> >
> > That's a big clue. Does he really not have the Forms library listed in
> > the References list box? Even if it not checked, it should be present in
> > the list. MSFORMS is part of the basic Excel installation, not optional in
> > any way. If "Microsoft Forms 2.0 Object Library" doesn't appear at all in
> > the References list, the basic installation of Excel is bad.
> >
> > The first thing I'd advise to your user is to unregister and re-register
> > Excel. Close Excel (and all other Office programs), go to the Windows
> > Start menu, choose Run and enter
> >
> > RegSvr32 "Excel.exe" /unregserver
> >
> > The repeat the process with
> >
> > RegSvr32 "Excel.exe" /regserver
> >
> > You may have to use the full file path of Excel instead of just
> > "Excel.exe". In the Immediate window of VBA, enter the following and press
> > Enter.
> >
> > ?Application.Path & "\Excel.exe"
> >
> > This will display the full pathname of Excel.exe. Use that filename in
> > place of "Excel.exe" in the RegSvr32 commands.
> >
> > Now try to open the workbook. In VBA, ensure that "Microsoft Forms 2.0
> > Object Library" appears in the list of references. Try adding a UserForm
> > to the project. Doing so will automatically add a reference to MSFORMS.
> >
> > If this fails, and you (by which I mean your user) get an error message
> > when trying to add a UserForm, try to add the reference to MSFORMS
> > manually. In the References dialog, click "Browse" and navigate to the
> > file
> >
> > C:\WINDOWS\system32\FM20.DLL
> >
> > If you find the file, click OK or Open. If you don't find the file, then
> > you'll probably want to run "Detect And Repair" from the Help menu. If
> > this doesn't fix the problem, you'll likely need to uninstall and
> > reinstall Office.
> >
> > A missing MSFORMS reference item and/or a missing FM20.DLL file indicates
> > that something serious has gone on.
> >
> >
> > --
> > Cordially,
> > Chip Pearson
> > Microsoft MVP - Excel
> > Pearson Software Consulting, LLC
> > www.cpearson.com
> > (email address is on the web site)
> >
> >
> >
> >
> > "Otto Moehrbach" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> >> Excel XP & Win XP
> >> I'm helping an OP with a project. The code loops through all the files
> >> in a folder, opens each, does things, closes the file and opens the next
> >> file, etc.
> >> The code is placed in the Personal.xls file. It works fine for me. It
> >> fails on opening the first file for him (will not open the file). An
> >> error is produced saying that opening the file failed. He has Excel
> >> 2003.
> >> He sent me his Personal.xls file. I changed the name and put it in my
> >> XLSTART folder. It works fine with my path. I created his path on my
> >> computer and that works fine too.
> >> I checked the VBE - Tools - References. The only thing I have checked
> >> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
> >> anything like that to check.
> >> Does anyone have any ideas of what I could do? Thanks for your time.
> >> Otto
> >>
> >>

> >
> >


--

Dave Peterson
 
Reply With Quote
 
rjr
Guest
Posts: n/a
 
      1st Jan 2007
Run Time Error 1004 Method OPEN of object.workbooks failed. This is in
the Microsoft vb alert window. the Error place in the code is at

Do While TheFile <> ""
If TheFile <> "Daily Error report MASTER.xls" Then
MsgBox TheFile
>> Set wb = Workbooks.Open(ThePath & "\" & TheFile) << error

line.

I've sent Otto the files while he was working on the code. The code works
perfectly for him at his computer.
I can open ALL files from file open or double clicking on the file.



"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> What's the error that is displayed?
>
> Any chance that Otto has access to that folder and you don't?
>
> Can you open the file just via File|Open?
>
> rjr wrote:
>>
>> Hi, I've got the problem that Otto is helping me with. I've done a
>> complete
>> detect and repair and as Chip has suggested I've looked in the References
>> List box and I do have Microsoft Forms 2.0 Object Library installed and
>> checked. I also have the FM20.dll installed and visible. I also attempted
>> to
>> include a user form and it was installed without a hitch, absolutely no
>> problem.
>>
>> I did send the file to Otto and he can't recreate the problem. The code
>> performs as it should on his machine and completes. I still get the error
>> and the code stops, as Otto has said. Is there anything that anyone can
>> think of that I can do that he and I haven't. If uninstalling and
>> reinstalling Excel would work I could do that also.
>>
>> Thanks Bob Reynolds
>>
>> "Chip Pearson" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Do you know the exact wording of the error message? Is it coming from
>> > Excel or from VBA?
>> >
>> >> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
>> >> anything like that to check.
>> >
>> > That's a big clue. Does he really not have the Forms library listed in
>> > the References list box? Even if it not checked, it should be present
>> > in
>> > the list. MSFORMS is part of the basic Excel installation, not optional
>> > in
>> > any way. If "Microsoft Forms 2.0 Object Library" doesn't appear at all
>> > in
>> > the References list, the basic installation of Excel is bad.
>> >
>> > The first thing I'd advise to your user is to unregister and
>> > re-register
>> > Excel. Close Excel (and all other Office programs), go to the Windows
>> > Start menu, choose Run and enter
>> >
>> > RegSvr32 "Excel.exe" /unregserver
>> >
>> > The repeat the process with
>> >
>> > RegSvr32 "Excel.exe" /regserver
>> >
>> > You may have to use the full file path of Excel instead of just
>> > "Excel.exe". In the Immediate window of VBA, enter the following and
>> > press
>> > Enter.
>> >
>> > ?Application.Path & "\Excel.exe"
>> >
>> > This will display the full pathname of Excel.exe. Use that filename in
>> > place of "Excel.exe" in the RegSvr32 commands.
>> >
>> > Now try to open the workbook. In VBA, ensure that "Microsoft Forms 2.0
>> > Object Library" appears in the list of references. Try adding a
>> > UserForm
>> > to the project. Doing so will automatically add a reference to MSFORMS.
>> >
>> > If this fails, and you (by which I mean your user) get an error
>> > message
>> > when trying to add a UserForm, try to add the reference to MSFORMS
>> > manually. In the References dialog, click "Browse" and navigate to the
>> > file
>> >
>> > C:\WINDOWS\system32\FM20.DLL
>> >
>> > If you find the file, click OK or Open. If you don't find the file,
>> > then
>> > you'll probably want to run "Detect And Repair" from the Help menu. If
>> > this doesn't fix the problem, you'll likely need to uninstall and
>> > reinstall Office.
>> >
>> > A missing MSFORMS reference item and/or a missing FM20.DLL file
>> > indicates
>> > that something serious has gone on.
>> >
>> >
>> > --
>> > Cordially,
>> > Chip Pearson
>> > Microsoft MVP - Excel
>> > Pearson Software Consulting, LLC
>> > www.cpearson.com
>> > (email address is on the web site)
>> >
>> >
>> >
>> >
>> > "Otto Moehrbach" <(E-Mail Removed)> wrote in message
>> > news:%(E-Mail Removed)...
>> >> Excel XP & Win XP
>> >> I'm helping an OP with a project. The code loops through all the
>> >> files
>> >> in a folder, opens each, does things, closes the file and opens the
>> >> next
>> >> file, etc.
>> >> The code is placed in the Personal.xls file. It works fine for me.
>> >> It
>> >> fails on opening the first file for him (will not open the file). An
>> >> error is produced saying that opening the file failed. He has Excel
>> >> 2003.
>> >> He sent me his Personal.xls file. I changed the name and put it in my
>> >> XLSTART folder. It works fine with my path. I created his path on my
>> >> computer and that works fine too.
>> >> I checked the VBE - Tools - References. The only thing I have checked
>> >> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't
>> >> have
>> >> anything like that to check.
>> >> Does anyone have any ideas of what I could do? Thanks for your time.
>> >> Otto
>> >>
>> >>
>> >
>> >

>
> --
>
> Dave Peterson



 
Reply With Quote
 
rjr
Guest
Posts: n/a
 
      1st Jan 2007
As another note, I removed all macro securtiy and still the problem is
there..

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> What's the error that is displayed?
>
> Any chance that Otto has access to that folder and you don't?
>
> Can you open the file just via File|Open?
>
> rjr wrote:
>>
>> Hi, I've got the problem that Otto is helping me with. I've done a
>> complete
>> detect and repair and as Chip has suggested I've looked in the References
>> List box and I do have Microsoft Forms 2.0 Object Library installed and
>> checked. I also have the FM20.dll installed and visible. I also attempted
>> to
>> include a user form and it was installed without a hitch, absolutely no
>> problem.
>>
>> I did send the file to Otto and he can't recreate the problem. The code
>> performs as it should on his machine and completes. I still get the error
>> and the code stops, as Otto has said. Is there anything that anyone can
>> think of that I can do that he and I haven't. If uninstalling and
>> reinstalling Excel would work I could do that also.
>>
>> Thanks Bob Reynolds
>>
>> "Chip Pearson" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Do you know the exact wording of the error message? Is it coming from
>> > Excel or from VBA?
>> >
>> >> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
>> >> anything like that to check.
>> >
>> > That's a big clue. Does he really not have the Forms library listed in
>> > the References list box? Even if it not checked, it should be present
>> > in
>> > the list. MSFORMS is part of the basic Excel installation, not optional
>> > in
>> > any way. If "Microsoft Forms 2.0 Object Library" doesn't appear at all
>> > in
>> > the References list, the basic installation of Excel is bad.
>> >
>> > The first thing I'd advise to your user is to unregister and
>> > re-register
>> > Excel. Close Excel (and all other Office programs), go to the Windows
>> > Start menu, choose Run and enter
>> >
>> > RegSvr32 "Excel.exe" /unregserver
>> >
>> > The repeat the process with
>> >
>> > RegSvr32 "Excel.exe" /regserver
>> >
>> > You may have to use the full file path of Excel instead of just
>> > "Excel.exe". In the Immediate window of VBA, enter the following and
>> > press
>> > Enter.
>> >
>> > ?Application.Path & "\Excel.exe"
>> >
>> > This will display the full pathname of Excel.exe. Use that filename in
>> > place of "Excel.exe" in the RegSvr32 commands.
>> >
>> > Now try to open the workbook. In VBA, ensure that "Microsoft Forms 2.0
>> > Object Library" appears in the list of references. Try adding a
>> > UserForm
>> > to the project. Doing so will automatically add a reference to MSFORMS.
>> >
>> > If this fails, and you (by which I mean your user) get an error
>> > message
>> > when trying to add a UserForm, try to add the reference to MSFORMS
>> > manually. In the References dialog, click "Browse" and navigate to the
>> > file
>> >
>> > C:\WINDOWS\system32\FM20.DLL
>> >
>> > If you find the file, click OK or Open. If you don't find the file,
>> > then
>> > you'll probably want to run "Detect And Repair" from the Help menu. If
>> > this doesn't fix the problem, you'll likely need to uninstall and
>> > reinstall Office.
>> >
>> > A missing MSFORMS reference item and/or a missing FM20.DLL file
>> > indicates
>> > that something serious has gone on.
>> >
>> >
>> > --
>> > Cordially,
>> > Chip Pearson
>> > Microsoft MVP - Excel
>> > Pearson Software Consulting, LLC
>> > www.cpearson.com
>> > (email address is on the web site)
>> >
>> >
>> >
>> >
>> > "Otto Moehrbach" <(E-Mail Removed)> wrote in message
>> > news:%(E-Mail Removed)...
>> >> Excel XP & Win XP
>> >> I'm helping an OP with a project. The code loops through all the
>> >> files
>> >> in a folder, opens each, does things, closes the file and opens the
>> >> next
>> >> file, etc.
>> >> The code is placed in the Personal.xls file. It works fine for me.
>> >> It
>> >> fails on opening the first file for him (will not open the file). An
>> >> error is produced saying that opening the file failed. He has Excel
>> >> 2003.
>> >> He sent me his Personal.xls file. I changed the name and put it in my
>> >> XLSTART folder. It works fine with my path. I created his path on my
>> >> computer and that works fine too.
>> >> I checked the VBE - Tools - References. The only thing I have checked
>> >> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't
>> >> have
>> >> anything like that to check.
>> >> Does anyone have any ideas of what I could do? Thanks for your time.
>> >> Otto
>> >>
>> >>
>> >
>> >

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Jan 2007
What do you see in the msgbox right before it fails?

Do you see "daily error report master.xls"?

If you do, then I'm guessing that the code that you're running is in a file with
that name.

Maybe this would help:

If lcase(TheFile) <> lcase("Daily Error report MASTER.xls") Then

(or maybe not!)


rjr wrote:
>
> Run Time Error 1004 Method OPEN of object.workbooks failed. This is in
> the Microsoft vb alert window. the Error place in the code is at
>
> Do While TheFile <> ""
> If TheFile <> "Daily Error report MASTER.xls" Then
> MsgBox TheFile
> >> Set wb = Workbooks.Open(ThePath & "\" & TheFile) << error

> line.
>
> I've sent Otto the files while he was working on the code. The code works
> perfectly for him at his computer.
> I can open ALL files from file open or double clicking on the file.
>
> "Dave Peterson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > What's the error that is displayed?
> >
> > Any chance that Otto has access to that folder and you don't?
> >
> > Can you open the file just via File|Open?
> >
> > rjr wrote:
> >>
> >> Hi, I've got the problem that Otto is helping me with. I've done a
> >> complete
> >> detect and repair and as Chip has suggested I've looked in the References
> >> List box and I do have Microsoft Forms 2.0 Object Library installed and
> >> checked. I also have the FM20.dll installed and visible. I also attempted
> >> to
> >> include a user form and it was installed without a hitch, absolutely no
> >> problem.
> >>
> >> I did send the file to Otto and he can't recreate the problem. The code
> >> performs as it should on his machine and completes. I still get the error
> >> and the code stops, as Otto has said. Is there anything that anyone can
> >> think of that I can do that he and I haven't. If uninstalling and
> >> reinstalling Excel would work I could do that also.
> >>
> >> Thanks Bob Reynolds
> >>
> >> "Chip Pearson" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > Do you know the exact wording of the error message? Is it coming from
> >> > Excel or from VBA?
> >> >
> >> >> he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't have
> >> >> anything like that to check.
> >> >
> >> > That's a big clue. Does he really not have the Forms library listed in
> >> > the References list box? Even if it not checked, it should be present
> >> > in
> >> > the list. MSFORMS is part of the basic Excel installation, not optional
> >> > in
> >> > any way. If "Microsoft Forms 2.0 Object Library" doesn't appear at all
> >> > in
> >> > the References list, the basic installation of Excel is bad.
> >> >
> >> > The first thing I'd advise to your user is to unregister and
> >> > re-register
> >> > Excel. Close Excel (and all other Office programs), go to the Windows
> >> > Start menu, choose Run and enter
> >> >
> >> > RegSvr32 "Excel.exe" /unregserver
> >> >
> >> > The repeat the process with
> >> >
> >> > RegSvr32 "Excel.exe" /regserver
> >> >
> >> > You may have to use the full file path of Excel instead of just
> >> > "Excel.exe". In the Immediate window of VBA, enter the following and
> >> > press
> >> > Enter.
> >> >
> >> > ?Application.Path & "\Excel.exe"
> >> >
> >> > This will display the full pathname of Excel.exe. Use that filename in
> >> > place of "Excel.exe" in the RegSvr32 commands.
> >> >
> >> > Now try to open the workbook. In VBA, ensure that "Microsoft Forms 2.0
> >> > Object Library" appears in the list of references. Try adding a
> >> > UserForm
> >> > to the project. Doing so will automatically add a reference to MSFORMS.
> >> >
> >> > If this fails, and you (by which I mean your user) get an error
> >> > message
> >> > when trying to add a UserForm, try to add the reference to MSFORMS
> >> > manually. In the References dialog, click "Browse" and navigate to the
> >> > file
> >> >
> >> > C:\WINDOWS\system32\FM20.DLL
> >> >
> >> > If you find the file, click OK or Open. If you don't find the file,
> >> > then
> >> > you'll probably want to run "Detect And Repair" from the Help menu. If
> >> > this doesn't fix the problem, you'll likely need to uninstall and
> >> > reinstall Office.
> >> >
> >> > A missing MSFORMS reference item and/or a missing FM20.DLL file
> >> > indicates
> >> > that something serious has gone on.
> >> >
> >> >
> >> > --
> >> > Cordially,
> >> > Chip Pearson
> >> > Microsoft MVP - Excel
> >> > Pearson Software Consulting, LLC
> >> > www.cpearson.com
> >> > (email address is on the web site)
> >> >
> >> >
> >> >
> >> >
> >> > "Otto Moehrbach" <(E-Mail Removed)> wrote in message
> >> > news:%(E-Mail Removed)...
> >> >> Excel XP & Win XP
> >> >> I'm helping an OP with a project. The code loops through all the
> >> >> files
> >> >> in a folder, opens each, does things, closes the file and opens the
> >> >> next
> >> >> file, etc.
> >> >> The code is placed in the Personal.xls file. It works fine for me.
> >> >> It
> >> >> fails on opening the first file for him (will not open the file). An
> >> >> error is produced saying that opening the file failed. He has Excel
> >> >> 2003.
> >> >> He sent me his Personal.xls file. I changed the name and put it in my
> >> >> XLSTART folder. It works fine with my path. I created his path on my
> >> >> computer and that works fine too.
> >> >> I checked the VBE - Tools - References. The only thing I have checked
> >> >> that he doesn't is "Microsoft Forms 2.0 Object Library". He doesn't
> >> >> have
> >> >> anything like that to check.
> >> >> Does anyone have any ideas of what I could do? Thanks for your time.
> >> >> Otto
> >> >>
> >> >>
> >> >
> >> >

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
looping code Ksenija Microsoft Excel Programming 1 23rd Jan 2009 04:05 PM
Looping thru multiple files to produce a consolidated summary by Code u473 Microsoft Excel Programming 12 19th Sep 2007 06:19 PM
Looping code Stu Microsoft Access Form Coding 3 28th May 2007 02:38 PM
Help with Looping Code JimMay Microsoft Excel Programming 5 6th Jun 2006 03:43 AM
looping to run vb code -help =?Utf-8?B?U2hhd25h?= Microsoft Access Getting Started 3 3rd Apr 2004 06:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:07 PM.