From: ryguy7272 on 11 Dec 2009 16:38 Thanks Captain Jack. I just saw the solution here: http://visualbasic.ittoolbox.com/groups/technical-functional/visualbasic-l/opening-a-new-excel-file-in-vb6-561487 Regards, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Captain Jack" wrote: > "ryguy7272" <ryguy7272(a)discussions.microsoft.com> wrote in message > news:D2122F9D-BC07-4397-BB2F-E5F79117BB89(a)microsoft.com... > > Thanks Patrice. I added this: > > Dim EXL As Excel.Workbook > > > > Then, when I run the project, I get this message: 'object variable or with > > block variable not set' > > > > This line i syellow: > > WSheet = EXL.Workbooks.Open("C:\TEST.XLS").Worksheets.Item(1) > > > > Any ideas? > > > > Thanks! > > Ryan--- > > > > Workbooks is a property of the Excel Application object, so your EXL > variable would need to be of that type. Also, you're declaring it, but > you're not assigning it a value, so that's why you're getting the error. > > To declare EXL so it will work, you'll need something like this: > > Dim EXL As New Excel.Application > > This will start an Excel process on your system. If you don't want to see a > window for it, you may want to set the Visible property of EXL to False. > When you're done processing your file, you'll probably want to call the Quit > method of EXL to stop the running application. > > -- > Jack > > > . > |