Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm running Access automation to Excel, and have in Module1, but it's not
running... Sub AUTO_OPEN() Application.ScreenUpdating = False Sheets("Details").Select Columns("L:L").Select Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)" Columns("M:M").Select Selection.NumberFormat = "0" Columns("N:N").Select Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)" Sheets("Sheet1").Select: Range("A1").Select Application.ScreenUpdating = True End Sub TIA - Bob |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You have a couple of choices.
#1. Run the auto_open macro yourself. This worked in MSWord. I didn't test it using Access: Dim xlApp As Object Dim wkbk As Object Set xlApp = CreateObject("Excel.application") Set wkbk = xlApp.workbooks.Open(FileName:="c:\my documents\excel\book1.xls") wkbk.runautomacros 1 'same as xlAutoOpen, see excel's help for more info #2. Don't use auto_open in a general module. Move your code behind the ThisWorkbook module and name it: Private Sub Workbook_Open() .... End sub ======= You have to stop the workbook_open event from running if you don't want it to run. But you have to run auto_open if you want that to run. Bob Barnes wrote: I'm running Access automation to Excel, and have in Module1, but it's not running... Sub AUTO_OPEN() Application.ScreenUpdating = False Sheets("Details").Select Columns("L:L").Select Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)" Columns("M:M").Select Selection.NumberFormat = "0" Columns("N:N").Select Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)" Sheets("Sheet1").Select: Range("A1").Select Application.ScreenUpdating = True End Sub TIA - Bob -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave - Beautiful. Thank you - Bob
"Dave Peterson" wrote: You have a couple of choices. #1. Run the auto_open macro yourself. This worked in MSWord. I didn't test it using Access: Dim xlApp As Object Dim wkbk As Object Set xlApp = CreateObject("Excel.application") Set wkbk = xlApp.workbooks.Open(FileName:="c:\my documents\excel\book1.xls") wkbk.runautomacros 1 'same as xlAutoOpen, see excel's help for more info #2. Don't use auto_open in a general module. Move your code behind the ThisWorkbook module and name it: Private Sub Workbook_Open() .... End sub ======= You have to stop the workbook_open event from running if you don't want it to run. But you have to run auto_open if you want that to run. Bob Barnes wrote: I'm running Access automation to Excel, and have in Module1, but it's not running... Sub AUTO_OPEN() Application.ScreenUpdating = False Sheets("Details").Select Columns("L:L").Select Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)" Columns("M:M").Select Selection.NumberFormat = "0" Columns("N:N").Select Selection.NumberFormat = "$#,##0.00_);[Red]($#,##0.00)" Sheets("Sheet1").Select: Range("A1").Select Application.ScreenUpdating = True End Sub TIA - Bob -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto_open and more.... | New Users to Excel | |||
Auto_open and more.... | New Users to Excel | |||
Auto_open | Excel Discussion (Misc queries) | |||
Help with 'Auto_Open' please... | Excel Discussion (Misc queries) | |||
auto_open? | Excel Discussion (Misc queries) |