![]() |
autorun macro from access
I have a macro i have created in excel and I have an access db that i want to
call an excel file run this macro against it. Now i do not want to run this macro from my personal.xls or have to drop this in the xlstart folder. what i would like is to just create a macro.xls file with the macros in and when i call excel from access open the "logfile.xls" and run a macro on it from the "macro.xls" file. Alternately if i can copy the macro from access to excel when opening "logfile.xls" that would work to. The logfile.xls comes from another person without any macros in it. i format the file with my macro and resave it. but i want to do this from access. further i want to copy this to the server so that anyone can do this by hitting the command button, so it cannot reside on my local machine. Any ideas? I have the following code in access but it doesnt even seem to open the file with my personal.xls. Private Sub Command3_Click() Dim objXL As Object, x On Error Resume Next Set objXL = CreateObject("Excel.Application") With objXL.Application .Visible = True 'Open the Workbook .Workbooks.Open "C:\testlog.XLS" .ActiveWorkbook.RunAutoMacros xlAutoOpen x = .Run("log2sms", 0) End With Set objXL = Nothing End Sub |
All times are GMT +1. The time now is 11:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com