#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default run macro on opening

Hi
(originally put in wrong grouping)

I have go this off other threads, but would like it to run automatically when
opening the workbook. I am not up to speed with these codes, and therefore
ask if the additional line/lines could be added in the correct place, in
order that I can copy and Paste. Currently, I have to run this every time
after opening the workbook

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="test", userinterfaceonly:=True
.EnableAutoFilter = True
End With

End Sub

Can anyone help?,

Brian

--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default run macro on opening

You need your code in ThisWorkbook. Use this.

Private Sub Workbook_Open()
With Worksheets("sheet1")
Protect Password:="test", userinterfaceonly:=True
EnableAutoFilter = True
End With
End Sub

HTH,
Paul

"brian thompson3001 via OfficeKB.com" <u15682@uwe wrote in message
news:6a855ded5e2ae@uwe...
Hi
(originally put in wrong grouping)

I have go this off other threads, but would like it to run automatically
when
opening the workbook. I am not up to speed with these codes, and
therefore
ask if the additional line/lines could be added in the correct place, in
order that I can copy and Paste. Currently, I have to run this every time
after opening the workbook

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
Protect Password:="test", userinterfaceonly:=True
EnableAutoFilter = True
End With

End Sub

Can anyone help?,

Brian

--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default run macro on opening

Open the workbook.
Go to the VBE
Hit ctrl-r to see the project explorer
Find your workbook/project
click on it one time
Insert|Module

Paste the code there (and delete any copies of that code you placed elsewhere).

Alt-f11 to get back to excel
close that file (and save it while saving)
reopen that file (allowing macros to run)



"brian thompson3001 via OfficeKB.com" wrote:

Hi
(originally put in wrong grouping)

I have go this off other threads, but would like it to run automatically when
opening the workbook. I am not up to speed with these codes, and therefore
ask if the additional line/lines could be added in the correct place, in
order that I can copy and Paste. Currently, I have to run this every time
after opening the workbook

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
Protect Password:="test", userinterfaceonly:=True
EnableAutoFilter = True
End With

End Sub

Can anyone help?,

Brian

--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default run macro on opening

hi paul/dave

have copied your code following Dave's instructions, however getting
"Compile error"
"named argument not found"

Any idea's

regards

PCLIVE wrote:
You need your code in ThisWorkbook. Use this.

Private Sub Workbook_Open()
With Worksheets("sheet1")
Protect Password:="test", userinterfaceonly:=True
EnableAutoFilter = True
End With
End Sub

HTH,
Paul

Hi
(originally put in wrong grouping)

[quoted text clipped - 19 lines]

Brian


--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default run macro on opening

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
'.EnableOutlining = True
.EnableAutoFilter = True
End With
End Sub

Watch those leading dots.



"brian thompson3001 via OfficeKB.com" wrote:

hi paul/dave

have copied your code following Dave's instructions, however getting
"Compile error"
"named argument not found"

Any idea's

regards

PCLIVE wrote:
You need your code in ThisWorkbook. Use this.

Private Sub Workbook_Open()
With Worksheets("sheet1")
Protect Password:="test", userinterfaceonly:=True
EnableAutoFilter = True
End With
End Sub

HTH,
Paul

Hi
(originally put in wrong grouping)

[quoted text clipped - 19 lines]

Brian


--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default run macro on opening

thanks dave

works well .

regards

Dave Peterson wrote:
Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
'.EnableOutlining = True
.EnableAutoFilter = True
End With
End Sub

Watch those leading dots.

hi paul/dave

[quoted text clipped - 29 lines]
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1



--
bnt

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200612/1

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
opening access database using macro rtphilips New Users to Excel 3 October 20th 05 05:11 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Opening a file in a macro (network) David P. Excel Discussion (Misc queries) 3 June 8th 05 12:35 AM
Macro warning (upon opening) Richard Excel Discussion (Misc queries) 4 February 18th 05 10:43 PM
After deleting a macro, I still get the pop-up when opening file Anne Excel Worksheet Functions 2 December 8th 04 05:31 PM


All times are GMT +1. The time now is 10:22 AM.

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"