Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autorun Macro on file opening


Hi All,
Big Thank-you for your help. I found when I used Workbook_open i
simple opened the file - it didn't run the macro as well. I found
techo at work and he said to try "Sub Auto_Open()". And this worke
however I get the following error - " filename.csv is already.
Reopening will cause any changes you made to be discarded. Do you wan
to reopen filename.csv? " -
if you reply YES then the macro changes are undone, if you reply NO th
file is exactly how I want it to Open. However I would like it with-ou
this msg interaction.

Does anyone understand why I would get this reOpening msg ? if so, ho
can I get rid of it?

This is my code, I'm a real beginner at VB, so basically kno
nothing... I am however, an automation programmer and are learnin
slowly about Excel.
Sub Auto_Open()
'
' Macro1
' Macro recorded 27/10/2004 by me'
ActiveWorkbook.Save
ChDir "\\servername\test"
Workbooks.Open Filename:="\\servername\test\filename.csv"
Cells.Select
Cells.EntireColumn.AutoFit
Range("B:B,K1,K:K").Select
Range("K1").Activate
ActiveWindow.LargeScroll ToRight:=2
Range("B:B,K1,K:K,S:S").Select
Range("S1").Activate
ActiveWindow.LargeScroll ToRight:=2
ActiveWindow.SmallScroll ToRight:=-24
Selection.NumberFormat = "0"
ActiveWindow.LargeScroll ToRight:=-3
Columns("D:D").Select
ActiveWindow.LargeScroll ToRight:=2
ActiveWindow.SmallScroll ToRight:=1
Range("D:D,T:T,W:W").Select
Range("W1").Activate
ActiveWindow.SmallScroll ToRight:=9
Range("D:D,T:T,W:W,AH:AH").Select
Range("AH1").Activate
ActiveWindow.SmallScroll ToRight:=5
Range("D:D,T:T,W:W,AH:AH,AJ:AJ").Select
Range("AJ1").Activate
ActiveWindow.SmallScroll ToRight:=7
Selection.NumberFormat = "$#,##0.00"
ActiveWindow.LargeScroll ToRight:=-5
Columns("F:F").Select
ActiveWindow.SmallScroll ToRight:=6
Range("F:F,L:L").Select
Range("L1").Activate
ActiveWindow.SmallScroll ToRight:=8
Range("F:F,L:L,U:U,V:V").Select
Range("V1").Activate
ActiveWindow.SmallScroll ToRight:=7
Range("F:F,L:L,U:U,V:V,AC:AC").Select
Range("AC1").Activate
ActiveWindow.SmallScroll ToRight:=6
Range("F:F,L:L,U:U,V:V,AC:AC,AM:AM").Select
Range("AM1").Activate
ActiveWindow.SmallScroll ToRight:=7
Selection.NumberFormat = "dd/mm/yyyy;@"
ActiveWindow.LargeScroll ToRight:=-5
Range("A1").Select
ActiveSheet.Protection.AllowEditRanges.Add Title:="LockColumns"
Range:=Range( _
"V:W,AL:AQ")
ActiveSheet.Protect DrawingObjects:=False, Contents:=True
Scenarios:= _
False, AllowFormattingCells:=True
AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True
AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True
AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True
AllowFiltering:=True, _
AllowUsingPivotTables:=True
End Su

--
Sha-aut
-----------------------------------------------------------------------
Sha-auto's Profile: http://www.excelforum.com/member.php...fo&userid=1570
View this thread: http://www.excelforum.com/showthread.php?threadid=27233

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autorun Macro on file opening


Make sure you turn the Macro Security to LOW in excel. This is the onl
way the Private Sub Workbook_Open() will work on open without any use
interaction

--
bawaho
-----------------------------------------------------------------------
bawahoo's Profile: http://www.excelforum.com/member.php...fo&userid=1510
View this thread: http://www.excelforum.com/showthread.php?threadid=27233

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
Autorun Macro on file opening Sha-auto Excel Programming 3 October 26th 04 03:53 AM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM
autorun code when opening sheet (not workbook) Steve Mutambo Excel Programming 3 April 2nd 04 04:46 PM
Autorun macro on opening spreadsheet simonjackson79 Excel Programming 3 November 5th 03 02:22 PM
autorun macro hke[_3_] Excel Programming 6 October 16th 03 01:18 PM


All times are GMT +1. The time now is 10:21 PM.

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

About Us

"It's about Microsoft Excel"