Hello Guys...
I have a problem in this code :
Dim oExcel As Object
Dim objExlSht As Object
Dim vas As Variant
Dim Db1 As DAO.Database
Dim Rs1 As DAO.Recordset
Dim blnIsOpen As Boolean
Set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Add
Set objExlSht = oExcel.ActiveWorkbook.Sheets(1)
'the error happens here.
With Worksheets("Plan1").Range("A2")
.CurrentRegion.Clear
.CopyFromRecordset Rs1
End With
Could someone helpe me, please??
maybe you do not have sheet "Plan1" without file is hard to say what's going on.
Last edited by tom1977; 11-18-2011 at 06:22 AM.
Regards
tom1977
If You are satisfied with my solution click the small star icon on the left to say thanks.
my suggestion is: attach the file with Your code (remove any confidential data of course)
Regards
tom1977
If You are satisfied with my solution click the small star icon on the left to say thanks.
code tags make it easier for people to see and read the code - use [ code] without the space before and [ /code] without the space after
Dim oExcel As Object Dim objExlSht As Object Dim vas As Variant Dim Db1 As DAO.Database Dim Rs1 As DAO.Recordset Dim blnIsOpen As Boolean Set oExcel = CreateObject("Excel.Application") oExcel.Workbooks.Add Set objExlSht = oExcel.ActiveWorkbook.Sheets(1) 'the error happens here. With Worksheets("Plan1").Range("A2") .CurrentRegion.Clear .CopyFromRecordset Rs1 End With
If genius is 99% perspiration - 1% inspiration, I know where I'm stuck
Understood...
I don't know... The unique thing that i want to do is to show a excel sheet.. every time that press a buttom...
But... The first time that I try.. I can, but if I show this sheet, close and press the buttom again... this problem happen...
I've never used excel for this...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks