Jim, I guess the trouble is I'm not an experienced vba programmer
so I still have troubles with this even when ?I cut and past the code
from the link.
Maybe, I am over thinking this and there may really be a better solution
this is what I have that will run my macros automatically on open
How would it be if we could make this conditional on if anything is in
cell A11 as far as whether the macro run or not?
---------------------------------------
Private Sub auto1()
With ActiveWorkbook
.RunAutoMacros xlAutoOpen
.Open
End With
End Sub
'Create the Tool list Sheet
Sub auto_open()
---------------------------------------
Because once this has run there will be something in there, and no need to
run again..
Does this sound like a better solution
Regards,
<Jeff>
"Jim Thomlinson" <James_Thomlinson@owfg-Re-Move-This-.com> wrote in message
news:5701B23C-9EFE-489D-AC79-(E-Mail Removed)...
> Bob's code is correct but perhaps this will help a bit.
>
> http://www.cpearson.com/excel/vbe.aspx
>
> Also note that you are probably using before_close as your event. That
> event
> fires When you hit the close button. If you cancel the close at that time
> then the code has already executed and the spread sheet will remain open
> but
> the module will be removed...
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Jeff W." wrote:
>
>> Bob, I'm not sure I have put this in correctly,
>> I get a compile error in hidden module
>>
>> I have an auto run macro that calls another sub to run and
>> I have put this at the bottom of the second sub
>>
>>
>> not sure if this is right, but it doesnt want to work.
>>
>> the debugger hanfs on the SET part of the additional code
>>
>> <Jeff>
>>
>>
>>
>>
>> "Bob Phillips" <(E-Mail Removed)> wrote in message
>> news:Oel6iu$(E-Mail Removed)...
>> > Dim vbMod As Object
>> >
>> > Set vbMod = ActiveWorkbook.VBProject.VBComponents(moduleName)
>> > ThisWorkbook.VBProject.VBComponents.Remove vbMod
>> >
>> >
>> > --
>> > ---
>> > HTH
>> >
>> > Bob
>> >
>> > (there's no email, no snail mail, but somewhere should be gmail in my
>> > addy)
>> >
>> >
>> >
>> > "Jeff W." <(E-Mail Removed)> wrote in message
>> > news:OC3hkn$(E-Mail Removed)...
>> >>I have a work book that gets copied and renamed by another application
>> >> and when it runs it automatically fills with data, and I would like to
>> >> make
>> >> it so after you close and reopen, it doesnt try to auto run again.
>> >>
>> >> Is this possible? I guess I want to delete all autorun macros on exit?
>> >>
>> >>
>> >> Thanks
>> >>
>> >> Jeff W.
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>>