ollie Posted November 30, 2008 Posted November 30, 2008 Hey folks I wrote a file comparison script for excel (i know this isn't an excel forum) that opens two files as read only. it worked thing when i was demonstrating tot he staff who will be using it but conveniently stopped working while i was showing the manager. can anyone suggest why this may have happened. Combobox1 and 2 were filled using Dim fso As New FileSystemObject Dim fld As Folder Dim fil As File Set fld = fso.GetFolder("C:\vba excel compare" For Each fil In fld.Files ComboBox1.AddItem fil.Name ComboBox2.AddItem fil.Name next fil Let Wbook = ComboBox1.Value 'value "reg 1.xls" Let Wbook2 = ComboBox2.Value 'value "reg 2.xls" Workbooks.Open Filename:=Wbook2, ReadOnly:=True Workbooks.Open Filename:=Wbook, ReadOnly:=True i am now getting runtime error 1004 Reg 2.xls could not be found. please check the spelling of the file name and make sure the location is correct Any help would be appreciated cheers, Ollie. Quote
rocheey Posted December 1, 2008 Posted December 1, 2008 >>Set fld = fso.GetFolder("C:\vba excel compare" I'd start by adding a trailing parentheses to the above line. then id check to see that the file names are in your comboboxes Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.