Thread: AUTO_OPEN
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Barnes Bob Barnes is offline
external usenet poster
 
Posts: 134
Default AUTO_OPEN

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