I am trying to export an Access report out to Excel. I am using OLE to do this. It is moving along pretty smoothly except that I am getting an error - but not all of the time - over this section of code which is only intended to cut headers from one place to another:
.Range("A6".Select
.Selection.Cut Destination:=Range("A1"
.Range("B6".Select
.Selection.Cut Destination:=Range("A2"
.Range("C6".Select
.Selection.Cut Destination:=Range("A3"
.Range("E6".Select
.Selection.Cut Destination:=Range("A4"
(This exists within a With statement for Object xlObject)
The error that I get is:
Run Time Error #1004
Method 'Range' of object '_Global' failed.
Again, I get this error only about 50% of the time that I run this OLE macro. I copied the code, for the most part, from a macro that I created in Excel. Are there modifications that I have to make to get Access to recognize it? If so, why does it recognize it sometimes?
Please help! thanks.
.Range("A6".Select
.Selection.Cut Destination:=Range("A1"
.Range("B6".Select
.Selection.Cut Destination:=Range("A2"
.Range("C6".Select
.Selection.Cut Destination:=Range("A3"
.Range("E6".Select
.Selection.Cut Destination:=Range("A4"
(This exists within a With statement for Object xlObject)
The error that I get is:
Run Time Error #1004
Method 'Range' of object '_Global' failed.
Again, I get this error only about 50% of the time that I run this OLE macro. I copied the code, for the most part, from a macro that I created in Excel. Are there modifications that I have to make to get Access to recognize it? If so, why does it recognize it sometimes?
Please help! thanks.