PC Review


Reply
Thread Tools Rate Thread

Disable auto open

 
 
Rpettis31
Guest
Posts: n/a
 
      6th Jul 2009

I have a workbook that has code to update files. the file is manipulated and
presented. I need to disable the auto open code. I had code to ask if you
want to update the file however the users wanted that to go away after the
report was formatted.

I added the if isnull code to prevent the update from occuring and did not
realize I disabled the code that would prevent an update.

I need to disable the Auto_Open code before the contents are erased.

or can someone tell me how to save the contents of the workbook and get rid
of the code?

I have tried to change macro settings does not seem to work.

Held shift key does not work...same with Ctrl break...


Sub Auto_Open()

If IsNull(Cells(1, 2)) Then
Answer = MsgBox("Would you like to update this file?", vbYesNo +
vbExclamation, "UPDATE FILE?")
If Answer = 7 Then Exit Sub
End If

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual


Range("a1:bk1000").Select
Selection.ClearContents
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      6th Jul 2009

If I follow, in the open event you want to do something if not already done,
but if aleady done early exit without bothering the user. One idea -

Sub auto_open()
Dim nm As Name

On Error Resume Next
Set nm = ThisWorkbook.Names("Prelim")
On Error GoTo 0

If Not nm Is Nothing Then
If UCase(nm.RefersTo) = "=TRUE" Then Exit Sub
End If

' do stuff here
Range("A1").Value = "Prelim stuff"

If Not nm Is Nothing Then nm.Delete
' store a flag in a name
Set nm = ThisWorkbook.Names.Add("Prelim", "=True")
nm.Visible = False ' hide the name

End Sub

Regards,
Peter T

"Rpettis31" <(E-Mail Removed)> wrote in message
news:5B530C16-BA3D-465D-ABEC-(E-Mail Removed)...
>I have a workbook that has code to update files. the file is manipulated
>and
> presented. I need to disable the auto open code. I had code to ask if
> you
> want to update the file however the users wanted that to go away after the
> report was formatted.
>
> I added the if isnull code to prevent the update from occuring and did not
> realize I disabled the code that would prevent an update.
>
> I need to disable the Auto_Open code before the contents are erased.
>
> or can someone tell me how to save the contents of the workbook and get
> rid
> of the code?
>
> I have tried to change macro settings does not seem to work.
>
> Held shift key does not work...same with Ctrl break...
>
>
> Sub Auto_Open()
>
> If IsNull(Cells(1, 2)) Then
> Answer = MsgBox("Would you like to update this file?", vbYesNo +
> vbExclamation, "UPDATE FILE?")
> If Answer = 7 Then Exit Sub
> End If
>
> Application.ScreenUpdating = False
> Application.Calculation = xlCalculationManual
>
>
> Range("a1:bk1000").Select
> Selection.ClearContents



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Open + Disable on Final Product THE_RAMONES Microsoft Excel Programming 2 25th Nov 2008 06:34 PM
How can I disable auto folder open when a CD is inserted? Ken Varn Windows XP General 2 12th Apr 2006 05:55 PM
How to disable auto-open CD etc. Derek Harvey Windows XP General 2 28th Jan 2005 06:11 PM
Disable auto-open at log-in Ronnie Microsoft Outlook Discussion 1 10th Oct 2003 05:00 AM
Disable auto open Greg Microsoft Outlook Discussion 1 16th Aug 2003 01:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:00 PM.