I am trying to run an excel macro all from an Access madule. There are two parts to my problem.
Here is the excel macro, however I would like xlLastCell instead of 'AD69' and instead of 'AD68' I would like 'one cell up from xlLastCell.
Range("A2:AD69").Cut Destination:=Range("A1:AD68")
Here is my Module, how do I edit the excel macro so that it works?
Thanks in advance
Here is the excel macro, however I would like xlLastCell instead of 'AD69' and instead of 'AD68' I would like 'one cell up from xlLastCell.
Range("A2:AD69").Cut Destination:=Range("A1:AD68")
Here is my Module, how do I edit the excel macro so that it works?
Code:
Sub alterTXT()
Dim dbs As Database
Dim objXL As Object, objWB As Object
DoCmd.OutputTo acOutputTable, "Filtered", acFormatXLS, "C:\Local\Shared\FilterTemp.xls"
DoEvents
Set objXL = CreateObject("Excel.Application")
Set dbs = CurrentDb()
With objXL
.Visible = False
Set objWB = .Workbooks.Open("C:\Local\Shared\FilterTemp.xls")
'Desired excel macro
Range("A2:AD69").Cut Destination:=Range("A1:AD68")
objWB.Close True
.Quit
End With
End Sub
Thanks in advance