A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Insert VBA code with a macro in a .xls file by workbook open event



 
 
Thread Tools Display Modes
  #1  
Old July 29th 04, 08:03 AM posted to microsoft.public.excel.programming
mihai[_3_]
external usenet poster
 
Posts: 1
Default Insert VBA code with a macro in a .xls file by workbook open event

I have a macro that creates an .xls file every time it runs. I want th
macro to insert code in the new file by workbook open and before clos
event. The result should be that the new file executes some operatio
on open and close

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

Ads
  #2  
Old July 29th 04, 08:38 AM posted to microsoft.public.excel.programming
Bob Phillips[_6_]
external usenet poster
 
Posts: 11,272
Default Insert VBA code with a macro in a .xls file by workbook open event

Take a look at www.cpearson.com/excel/vbe.htm. This page shows you how to
dynamically add code.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mihai >" > wrote in message
...
> I have a macro that creates an .xls file every time it runs. I want the
> macro to insert code in the new file by workbook open and before close
> event. The result should be that the new file executes some operation
> on open and close.
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>



  #3  
Old July 29th 04, 10:11 AM posted to microsoft.public.excel.programming
Amedee Van Gasse[_3_]
external usenet poster
 
Posts: 102
Default Insert VBA code with a macro in a .xls file by workbook open event

Bob Phillips wrote:

> Take a look at www.cpearson.com/excel/vbe.htm. This page shows you
> how to dynamically add code.


And uninstall any virus scanners like McAfee. They are very efficient
at wiping your entire code module if you dare to use the methods
described in the quoted link.
I learned that the hard way.

--
Amedee Van Gasse
To top-post is human, to bottom-post and snip is sublime.
  #4  
Old July 29th 04, 10:54 AM posted to microsoft.public.excel.programming
Bob Phillips[_6_]
external usenet poster
 
Posts: 11,272
Default Insert VBA code with a macro in a .xls file by workbook open event

If that is true, and I must admit I have never experienced it with AVG, then
I would suggest that a different approach is taken. Uninstalling virus
scanners is a bit too drastic for me.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Amedee Van Gasse" > wrote in message
...
> Bob Phillips wrote:
>
> > Take a look at www.cpearson.com/excel/vbe.htm. This page shows you
> > how to dynamically add code.

>
> And uninstall any virus scanners like McAfee. They are very efficient
> at wiping your entire code module if you dare to use the methods
> described in the quoted link.
> I learned that the hard way.
>
> --
> Amedee Van Gasse
> To top-post is human, to bottom-post and snip is sublime.



  #5  
Old July 29th 04, 11:41 AM posted to microsoft.public.excel.programming
Frank Kabel
external usenet poster
 
Posts: 3,885
Default Insert VBA code with a macro in a .xls file by workbook open event

Hi
see:
http://www.cpearson.com/excel/vbe.htm

>-----Original Message-----
>I have a macro that creates an .xls file every time it

runs. I want the
>macro to insert code in the new file by workbook open and

before close
>event. The result should be that the new file executes

some operation
>on open and close.
>
>
>---
>Message posted from http://www.ExcelForum.com/
>
>.
>

  #6  
Old July 29th 04, 11:46 AM posted to microsoft.public.excel.programming
mihai[_4_]
external usenet poster
 
Posts: 1
Default Insert VBA code with a macro in a .xls file by workbook open event

Thanks for the help.
I found the answer for my question on that page. I found a lot of othe
interesting thinks there.
About the antivirus, I have NAV I will see what happens

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

  #7  
Old July 29th 04, 12:22 PM posted to microsoft.public.excel.programming
keepITcool
external usenet poster
 
Posts: 2,253
Default Insert VBA code with a macro in a .xls file by workbook open event



I partly agree with Amedee.

You have to TEST that McAfee will not see your legitimate code
as a virus. McAfee has a routine for 1 of the first macro virii
that aggressively wipes any code from ThisWorkbook that modifies
the VBproject.

But you CAN prevent being seen as a virus..
takes careful testing and the procedure to modify the VBproject must be
moved from ThisWorkbook module to a normal module.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Amedee Van Gasse wrote :

> Bob Phillips wrote:
>
> > Take a look at www.cpearson.com/excel/vbe.htm. This page shows you
> > how to dynamically add code.

>
> And uninstall any virus scanners like McAfee. They are very efficient
> at wiping your entire code module if you dare to use the methods
> described in the quoted link.
> I learned that the hard way.


  #8  
Old July 29th 04, 01:40 PM posted to microsoft.public.excel.programming
Amedee Van Gasse[_3_]
external usenet poster
 
Posts: 102
Default Insert VBA code with a macro in a .xls file by workbook open event

keepITcool wrote:

>
>
> I partly agree with Amedee.
>
> You have to TEST that McAfee will not see your legitimate code
> as a virus. McAfee has a routine for 1 of the first macro virii
> that aggressively wipes any code from ThisWorkbook that modifies
> the VBproject.
>
> But you CAN prevent being seen as a virus..
> takes careful testing and the procedure to modify the VBproject must
> be moved from ThisWorkbook module to a normal module.


Keep,

Been there, done that, and you know it from following
news:microsoft.public.nl.office.excel.

My code was in a normal module, and it was just called from an event
handler in ThisWorkbook. The normal module was still wiped.

Perhaps it also depends on the specific McAfee product. The "desktop"
product for end-users might work different compared to the "network"
product for companies.

--
Amedee Van Gasse using XanaNews 1.16.3.1
If it has an "X" in the name, it must be Linux?
  #9  
Old July 29th 04, 01:49 PM posted to microsoft.public.excel.programming
keepITcool
external usenet poster
 
Posts: 2,253
Default Insert VBA code with a macro in a .xls file by workbook open event

Amai.. Amedee!

send me one that gets wiped..
and i'll try to build it so it wont get wiped.

bottle of Lagavullin?


Amedee Van Gasse wrote :

> keepITcool wrote:
>
> >
> >
> > I partly agree with Amedee.
> >
> > You have to TEST that McAfee will not see your legitimate code
> > as a virus. McAfee has a routine for 1 of the first macro virii
> > that aggressively wipes any code from ThisWorkbook that modifies
> > the VBproject.
> >
> > But you CAN prevent being seen as a virus..
> > takes careful testing and the procedure to modify the VBproject must
> > be moved from ThisWorkbook module to a normal module.

>
> Keep,
>
> Been there, done that, and you know it from following
> news:microsoft.public.nl.office.excel.
>
> My code was in a normal module, and it was just called from an event
> handler in ThisWorkbook. The normal module was still wiped.
>
> Perhaps it also depends on the specific McAfee product. The "desktop"
> product for end-users might work different compared to the "network"
> product for companies.


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Which 'event' to run pivot chart formatting code on file open? David Charts and Charting in Excel 1 June 11th 09 02:22 PM
How to code VBA: Auto open workbook and run macro March Excel Discussion (Misc queries) 4 November 8th 07 08:25 PM
What code do I use to attach event handler that will open my user. TeresaManley Excel Worksheet Functions 2 May 5th 07 09:55 PM
Macro doesn't work when used as Workbook Open event Phil Excel Discussion (Misc queries) 2 October 20th 06 02:42 PM
Open Event Code Bug Tim[_36_] Excel Programming 4 April 26th 04 08:51 AM


All times are GMT +1. The time now is 11:28 AM.


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