Unanswered: getting Excel macros to run from access macros
I had a problem trying to figure out how to create a excel macro... That issue has since been fixed, On this thread
Using this code
Dim I As Integer
For I = 2 To Worksheets.Count
'copy from worksheet
Worksheets(I).Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row) _
'paste to new worksheet
Worksheets(1).Range("A" & Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row) _
For I = Worksheets.Count To 2 Step -1
Application.DisplayAlerts = False
'delete all worksheets bar the first
Application.DisplayAlerts = True
In Excel works just fine. But now i need to call this from access, and to be honest im not good at opening excel as an object from a access macro and having excel do its thing. ive done it before but im having particular trouble with this one... can anyone help me out?? I know we need to append objects to their respective ".methods" but with the "Worksheets" its acting funny.
You can still use the same code except for the last line. The concept is that you open up an instance of Excel object in MS Access. With that all the methods and properties of any Excel's work sheet or workbook are then accessible
By "last line" do you mean the end sub or the second to last line? In any case i tried what you suggested, but there are complications. You must append a object to the excel methods or excel will not terminate correctly. have you ever tried out this method and if so did the excel process terminate at the end?