Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable Auto_Open with VBA

I have an auto_open macro I would like to run only once. Ever.

Is there a way to diable this event programmatically? I thought abou
embedding code in the Window_open event to turn off the Auto_Ope
event.....

Yes, I could just set a cell value but I'm looking for ways to do i
without modifying the content of the spreadsheet. I could use
variable to stop the processing I want done but I can't seem to fin
one that remains behind when the workbook/application closes.

Thanks in advance for your help!

Warre

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disable Auto_Open with VBA

http://support.microsoft.com/default...09&Product=xlw
VBA: How To Delete a Sub Procedure After It Runs Once



--
Regards,
Tom Ogilvy

"wrkoch " wrote in message
...
I have an auto_open macro I would like to run only once. Ever.

Is there a way to diable this event programmatically? I thought about
embedding code in the Window_open event to turn off the Auto_Open
event.....

Yes, I could just set a cell value but I'm looking for ways to do it
without modifying the content of the spreadsheet. I could use a
variable to stop the processing I want done but I can't seem to find
one that remains behind when the workbook/application closes.

Thanks in advance for your help!

Warren


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable Auto_Open with VBA

Didn't work. Threw a 1004 run time error on the SET line

. "Programmatic access to Visual Basic Project is not trusted."

Dim x As Object
Set x = Application.VBE.ActiveVBProject.VBComponent

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Disable Auto_Open with VBA

xl2002 added more security measures.

You can toggle this (user by user) via:
Tools|Macro|Security|Trusted Sources Tab



"wrkoch <" wrote:

Didn't work. Threw a 1004 run time error on the SET line

"Programmatic access to Visual Basic Project is not trusted."

Dim x As Object
Set x = Application.VBE.ActiveVBProject.VBComponents

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disable Auto_Open with VBA

then grant programmatic access to the VBE (I believe).

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
xl2002 added more security measures.

You can toggle this (user by user) via:
Tools|Macro|Security|Trusted Sources Tab



"wrkoch <" wrote:

Didn't work. Threw a 1004 run time error on the SET line

"Programmatic access to Visual Basic Project is not trusted."

Dim x As Object
Set x = Application.VBE.ActiveVBProject.VBComponents

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable Auto_Open with VBA

Well that wasn't very nice! I can't do that on a corporate deployment.
Too bad -- it was exactly what I wanted to do! I'll have to figure
way to set some sort of variable that will travel with the workbook

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disable Auto_Open with VBA

I assume the Auto_Open performs some type of action. Can't you have it
check if the action has been performed and quit if it has?

If you want the variable approach

Public Sub Auto_open()
Dim nm As Name
On Error Resume Next
Set nm = ThisWorkbook.Names("myflag")
On Error GoTo 0
If Not nm Is Nothing Then
MsgBox "Already run"
Exit Sub
End If
ThisWorkbook.Names.Add Name:="myflag", _
RefersTo:="=1", Visible:=False
MsgBox "Name Created"
' code that does things
End Sub

--
Regards,
Tom Ogilvy

"wrkoch " wrote in message
...
Well that wasn't very nice! I can't do that on a corporate deployment.
Too bad -- it was exactly what I wanted to do! I'll have to figure a
way to set some sort of variable that will travel with the workbook.


---
Message posted from http://www.ExcelForum.com/



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable Auto_Open with VBA

Yup -- that's what I'm gonna do! Just started programming that up whe
I got your email. I appreciate the info -- couldn't figure out how t
check for the existence of the name in the collection.

Thanks

--
Message posted from http://www.ExcelForum.com

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
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
Excel 2004 Can't Disable Auto_Open Macro. What Now? SidBord Excel Programming 4 July 9th 04 08:09 PM


All times are GMT +1. The time now is 05:14 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"