#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 134
Default AUTO_OPEN

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default AUTO_OPEN

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   Report Post  
Posted to microsoft.public.excel.misc
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto_open and more.... pcor New Users to Excel 2 December 1st 06 02:07 AM
Auto_open and more.... Mike New Users to Excel 0 November 30th 06 07:13 PM
Auto_open dan Excel Discussion (Misc queries) 7 May 21st 06 10:41 AM
Help with 'Auto_Open' please... cdavidson Excel Discussion (Misc queries) 3 November 14th 05 04:53 PM
auto_open? Jack Sons Excel Discussion (Misc queries) 0 February 22nd 05 09:16 PM


All times are GMT +1. The time now is 06:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"