| | |
|
|
|
HELP!! Error1004: "Application-defined or object-defined" |
| message from jj on 6 May 2004 |
Hi, all.
I try to write to Excel from Access 2000 Form.
The Excel locates in network, and the Adp application
locates in local desktop.
I receive an error1004:"Application-defined or object-
defined" while the error stop at [lastRow = Cells.Find
(What:="*", After:=[A1], SearchOrder:=xlByRows,
SearchDirection:=xlPrevious).Row]
Any tips or suggestion is appreciated.
jj
code:
============================================
Dim xlsApp, xlsBook, xlsSheet
CCCfile = GetCCCFile.GetCCCFile("CCCexcel")
Set xlsApp = CreateObject("Excel.Application")
Set xlsBook = xlsApp.Workbooks.Open(CCCfile)
Set xlsSheet = xlsBook.Sheets("Sheet1")
Dim lastACol As Integer
Dim lastBCol As Integer
Dim lastARow As Integer
lastRow = Cells.Find(What:="*", After:=[A1],
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
lastBCol = Cells.Find(What:="*", After:=[A1],
SearchOrder:=xlByColumns,
SearchDirection:=xlPrevious).Column
|
| Dirk Goldgar replied to jj on 6 May 2004 |
"jj" <anonymous@discussions.microsoft.com> wrote in message
news:92e901c43387$6b6fb120$a401280a@phx.gbl
I'm not sure, because I haven't spent much time automating Excel, but I
suspect your error comes because of your use of [A1], might be
interpreted as a range object inside an Excel application, but doesn't
mean anything to Access. I also think you probably need to be
qualifying your reference to the Cells property with the worksheet
object you created. You might try this:
With xlSheet
lastRow = .Cells.Find(What:="*", After:=.Range("A1"), _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
End With
|
| anonymous replied to Dirk Goldgar on 6 May 2004 |
Hi, dirk,
Thanks for response.
Error: 1004 - Method 'Cells' of object '_Global' failed
please help?!
jj
message
automating Excel, but I
might be
application, but doesn't
to be
worksheet
("A1"), _
SearchDirection:=xlPrevious).Row
|
| Dirk Goldgar replied to anonymous on 6 May 2004 |
<anonymous@discussions.microsoft.com> wrote in message
news:977001c43397$add78f00$a301280a@phx.gbl
[I had written]
Bearing in mind that I'm not really conversant with automating Excel ...
Did you copy and paste my suggested code, or did you type it in? If the
latter, did you by any chance overlook the dot (.) in front of
".Cells.Find(" ? Did you modify the subsequent Find similarly -- I
think you'd have to -- or is that the one that is now failing?
|
| jj replied to Dirk Goldgar on 6 May 2004 |
AH!!!!!!!!@@
You are right! I missed the . before Cells!
Sorry for the careless and one thousand thanks to you.
Happy jj. ^___^
SearchDirection:=xlPrevious).Row
automating Excel ...
type it in? If the
front of
similarly -- I
failing?
|
|
Archived message: HELP!! Error1004: "Application-defined or object-defined" (MS Access Forms)