Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Use VBA (Macro) to Update Existing Macro

Hi.

I have about 100 files that have the same embedded macro in them. I
need to update one of the functions that is contained in the macro
code.

I know how to loop through all the files, open each one, and save/
close them.

What I don't know how to do is modify the embedded macro functions.

Can someone please tell me how I can replace a function with a new one
automatically so I don't have to open the code editor for each one.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Use VBA (Macro) to Update Existing Macro

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

should give you the ins and outs of writing code to manipulate code.

Hopefully your projects are not protected in any of the workbooks.

--
Regards,
Tom Ogilvy


"Jordan Marton" wrote:

Hi.

I have about 100 files that have the same embedded macro in them. I
need to update one of the functions that is contained in the macro
code.

I know how to loop through all the files, open each one, and save/
close them.

What I don't know how to do is modify the embedded macro functions.

Can someone please tell me how I can replace a function with a new one
automatically so I don't have to open the code editor for each one.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Use VBA (Macro) to Update Existing Macro

I have seen that site. I tried the following code:

Sub CopyModule()
Dim FName As String
With Workbooks("MasterBook")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export FName
End With
Workbooks("OldFile").VBProject.VBComponents.Import FName
End Sub

Figured I could export then import into the new excel file. Problem
is, my virus program keeps blocking me from saving this code, says it
is a Bloodhound virus or something. I am on a corporate network and
turning the virus checker off is not an option. Any other ideas?

On Feb 12, 9:36 am, Tom Ogilvy
wrote:
http://www.cpearson.com/excel/vbe.htm

should give you the ins and outs of writing code to manipulate code.

Hopefully your projects are not protected in any of the workbooks.

--
Regards,
Tom Ogilvy



"Jordan Marton" wrote:
Hi.


I have about 100 files that have the same embedded macro in them. I
need to update one of the functions that is contained in the macro
code.


I know how to loop through all the files, open each one, and save/
close them.


What I don't know how to do is modify the embedded macro functions.


Can someone please tell me how I can replace a function with a new one
automatically so I don't have to open the code editor for each one.


Thanks- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Use VBA (Macro) to Update Existing Macro

exporting a module does not remove the module. You would need to delete it
before importing a new one.

http://tinyurl.com/33edbs
has a list of articles discussing the bloodhound virus problem.

--
Regards,
Tom Ogilvy


"Jordan Marton" wrote:

I have seen that site. I tried the following code:

Sub CopyModule()
Dim FName As String
With Workbooks("MasterBook")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export FName
End With
Workbooks("OldFile").VBProject.VBComponents.Import FName
End Sub

Figured I could export then import into the new excel file. Problem
is, my virus program keeps blocking me from saving this code, says it
is a Bloodhound virus or something. I am on a corporate network and
turning the virus checker off is not an option. Any other ideas?

On Feb 12, 9:36 am, Tom Ogilvy
wrote:
http://www.cpearson.com/excel/vbe.htm

should give you the ins and outs of writing code to manipulate code.

Hopefully your projects are not protected in any of the workbooks.

--
Regards,
Tom Ogilvy



"Jordan Marton" wrote:
Hi.


I have about 100 files that have the same embedded macro in them. I
need to update one of the functions that is contained in the macro
code.


I know how to loop through all the files, open each one, and save/
close them.


What I don't know how to do is modify the embedded macro functions.


Can someone please tell me how I can replace a function with a new one
automatically so I don't have to open the code editor for each one.


Thanks- Hide quoted text -


- Show quoted text -




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Use VBA (Macro) to Update Existing Macro

So I checked out the link you sent and found one of the sites that
provides a workaround. So far so good.

One more question. Several of my files have password protected macro
code (you have to type the password in the editor to see it). Any way
around that?

On Feb 12, 10:25 am, Tom Ogilvy
wrote:
exporting a module does not remove the module. You would need to delete it
before importing a new one.

http://tinyurl.com/33edbs
has a list of articles discussing the bloodhound virus problem.

--
Regards,
Tom Ogilvy



"Jordan Marton" wrote:
I have seen that site. I tried the following code:


Sub CopyModule()
Dim FName As String
With Workbooks("MasterBook")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export FName
End With
Workbooks("OldFile").VBProject.VBComponents.Import FName
End Sub


Figured I could export then import into the new excel file. Problem
is, my virus program keeps blocking me from saving this code, says it
is a Bloodhound virus or something. I am on a corporate network and
turning the virus checker off is not an option. Any other ideas?


On Feb 12, 9:36 am, Tom Ogilvy
wrote:
http://www.cpearson.com/excel/vbe.htm


should give you the ins and outs of writing code to manipulate code.


Hopefully your projects are not protected in any of the workbooks.


--
Regards,
Tom Ogilvy


"Jordan Marton" wrote:
Hi.


I have about 100 files that have the same embedded macro in them. I
need to update one of the functions that is contained in the macro
code.


I know how to loop through all the files, open each one, and save/
close them.


What I don't know how to do is modify the embedded macro functions.


Can someone please tell me how I can replace a function with a new one
automatically so I don't have to open the code editor for each one.


Thanks- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Use VBA (Macro) to Update Existing Macro

No provision for opening a password protected project using code. Only
suggestions I have seen involve using sendkeys.

--
Regards,
Tom Ogilvy


"Jordan Marton" wrote in message
oups.com...
So I checked out the link you sent and found one of the sites that
provides a workaround. So far so good.

One more question. Several of my files have password protected macro
code (you have to type the password in the editor to see it). Any way
around that?

On Feb 12, 10:25 am, Tom Ogilvy
wrote:
exporting a module does not remove the module. You would need to delete
it
before importing a new one.

http://tinyurl.com/33edbs
has a list of articles discussing the bloodhound virus problem.

--
Regards,
Tom Ogilvy



"Jordan Marton" wrote:
I have seen that site. I tried the following code:


Sub CopyModule()
Dim FName As String
With Workbooks("MasterBook")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export FName
End With
Workbooks("OldFile").VBProject.VBComponents.Import FName
End Sub


Figured I could export then import into the new excel file. Problem
is, my virus program keeps blocking me from saving this code, says it
is a Bloodhound virus or something. I am on a corporate network and
turning the virus checker off is not an option. Any other ideas?


On Feb 12, 9:36 am, Tom Ogilvy
wrote:
http://www.cpearson.com/excel/vbe.htm


should give you the ins and outs of writing code to manipulate code.


Hopefully your projects are not protected in any of the workbooks.


--
Regards,
Tom Ogilvy


"Jordan Marton" wrote:
Hi.


I have about 100 files that have the same embedded macro in them. I
need to update one of the functions that is contained in the macro
code.


I know how to loop through all the files, open each one, and save/
close them.


What I don't know how to do is modify the embedded macro functions.


Can someone please tell me how I can replace a function with a new
one
automatically so I don't have to open the code editor for each one.


Thanks- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Use VBA (Macro) to Update Existing Macro

On Feb 13, 12:30 pm, "Tom Ogilvy" wrote:
No provision for opening a password protected project using code. Only
suggestions I have seen involve using sendkeys.

--
Regards,
Tom Ogilvy

"Jordan Marton" wrote in message

oups.com...



So I checked out the link you sent and found one of the sites that
provides a workaround. So far so good.


One more question. Several of my files have password protected macro
code (you have to type the password in the editor to see it). Any way
around that?


On Feb 12, 10:25 am, Tom Ogilvy
wrote:
exporting a module does not remove the module. You would need to delete
it
before importing a new one.


http://tinyurl.com/33edbs
has a list of articles discussing the bloodhound virus problem.


--
Regards,
Tom Ogilvy


"Jordan Marton" wrote:
I have seen that site. I tried the following code:


Sub CopyModule()
Dim FName As String
With Workbooks("MasterBook")
FName = .Path & "\code.txt"
.VBProject.VBComponents("Module1").Export FName
End With
Workbooks("OldFile").VBProject.VBComponents.Import FName
End Sub


Figured I could export then import into the new excel file. Problem
is, my virus program keeps blocking me from saving this code, says it
is a Bloodhound virus or something. I am on a corporate network and
turning the virus checker off is not an option. Any other ideas?


On Feb 12, 9:36 am, Tom Ogilvy
wrote:
http://www.cpearson.com/excel/vbe.htm


should give you the ins and outs of writing code to manipulate code.


Hopefully your projects are not protected in any of the workbooks.


--
Regards,
Tom Ogilvy


"Jordan Marton" wrote:
Hi.


I have about 100 files that have the same embedded macro in them. I
need to update one of the functions that is contained in the macro
code.


I know how to loop through all the files, open each one, and save/
close them.


What I don't know how to do is modify the embedded macro functions.


Can someone please tell me how I can replace a function with a new
one
automatically so I don't have to open the code editor for each one.


Thanks- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


I was able to sucessfully implement SendKeys.

My process now loops through a folder of Excel files. Opens each one,
makes sheet changes. Unprotects the VBA code using send keys. Uses a
delete procedure to remove an old function. Then uses code to import a
new module (containing the updated function). Saves, closes, and
uploads to SharePoint.

SendKeys was a pain to implement but I found good code online. And I
got a workaround for the importing a new module so no more virus
alerts. Thanks for all the help!

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
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Use existing macro to create another macro fullers Excel Programming 1 February 16th 06 09:56 AM
Recording a macro within existing macro. BBQDad[_2_] Excel Programming 2 February 9th 05 10:09 PM
Macro Help - check existing tabs Macro Help[_2_] Excel Programming 1 July 27th 04 05:15 PM
Change to existing macro Jerry[_14_] Excel Programming 5 November 4th 03 01:51 PM


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