Automatic macro


Posted by Marcus Mansukhani on November 07, 2000 8:53 AM

I'm trying to set up a macro that will run automatically. The main function is for it to open two excel sheets and then close one of them and itself leaving just the third sheet open. Perhaps at the end minimising Excel.

So far I've got:

Sub Licence()
'
' Licence Macro
' Macro recorded 07/11/2000 by Marcus Mansukhani
'

'
ChDir "\\<servername>\systems"
Workbooks.Open Filename:="\\<servername>\Systems\Licence 1.xls"
Workbooks.Open Filename:="\\<servername>\systems\Licence.xls"
Range("C3").Select

End Sub

More than anything I'm trying to get the macro to start automatically. (It runs just fine)

FYI: The file "Licence 1.xls" is an export from MS Access and "Licence.xls" is a tidied version with a few calculations. I'm then pulling the file back into the Access DB. Crude but effective.

Posted by Christopher Mains on November 08, 2000 7:43 AM

Licence Macro Macro recorded 07/11/2000 by Marcus Mansukhani

Im not 100% clear on what you want done but this is how I got VBA to excute when a workbook is open.
In the ThisWorkbook Microsoft Excel Object put
Private Sub WorkBook_Open()
ChDir "\\<servername>\systems"
Workbooks.Open Filename:="\\<servername>\Systems\Licenc~1.xls" Workbooks.Open Filename:="\\<servername>\systems\Licence.xls" Range("C3").Select

End Sub



Posted by Feargal Tierney on November 14, 2000 3:20 AM

I need to run a macro when a workbook is opened, unfortunately the name and creation of the workbook is beyond my control. When it opens excel i want to be able to lock the cells against change and allow the user to make a selection from a button which runs one of several macros.

All of this works bar the, auto running of the macro in a workbook of an unknown name.

Any ideas please?