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

Hello,

Is is possible to detect the code change happened to VBA project? Or
something like "save" event of VBA project (not workbook)?

I intend to leave a mark in worksheet cells if VBA code has been
edited, and next time when the book is opened, I can perform some
processing if the mark is on and then turn off it.

Thanks in advance.

Ting
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default VBA Code Change

Why not just protect your code to prevent changes. In the VB editor,
ToolsVBAProjectPropertiesProtect

You can set a password to prevent unauthorized changes by most users.
Of course, passwords can be overcome by astute users, but it would be
effective against most.

" wrote:

Hello,

Is is possible to detect the code change happened to VBA project? Or
something like "save" event of VBA project (not workbook)?

I intend to leave a mark in worksheet cells if VBA code has been
edited, and next time when the book is opened, I can perform some
processing if the mark is on and then turn off it.

Thanks in advance.

Ting

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VBA Code Change

No, I permit source code change, instead of protecting it.

In VBA project, some constants are defined, which serve as
configuration purpose. When configuration changes, I need
to do something like re-formatting in the workbook the next time
it is opened (according to the new configuration).

So the most expected behaviour is that some mark can be done
"automatically" once VBA project is changed.

Ting


On Mar 19, 12:23 pm, JLGWhiz
wrote:
Why not just protect your code to prevent changes. In the VB editor,
ToolsVBAProjectPropertiesProtect

You can set a password to prevent unauthorized changes by most users.
Of course, passwords can be overcome by astute users, but it would be
effective against most.

" wrote:
Hello,


Is is possible to detect the code change happened to VBA project? Or
something like "save" event of VBA project (not workbook)?


I intend to leave a mark in worksheet cells if VBA code has been
edited, and next time when the book is opened, I can perform some
processing if the mark is on and then turn off it.


Thanks in advance.


Ting


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default VBA Code Change

I don't believe VBA supports a self editing capability, other than the
compiler, syntax and structure edits. If the changes do not generate errors,
then the built in edits would never detect the changes.

I don't know if the 'LastModified' property would be that useful since it
might not refer to code modifications. You can check that out in VBA help.

" wrote:

No, I permit source code change, instead of protecting it.

In VBA project, some constants are defined, which serve as
configuration purpose. When configuration changes, I need
to do something like re-formatting in the workbook the next time
it is opened (according to the new configuration).

So the most expected behaviour is that some mark can be done
"automatically" once VBA project is changed.

Ting


On Mar 19, 12:23 pm, JLGWhiz
wrote:
Why not just protect your code to prevent changes. In the VB editor,
ToolsVBAProjectPropertiesProtect

You can set a password to prevent unauthorized changes by most users.
Of course, passwords can be overcome by astute users, but it would be
effective against most.

" wrote:
Hello,


Is is possible to detect the code change happened to VBA project? Or
something like "save" event of VBA project (not workbook)?


I intend to leave a mark in worksheet cells if VBA code has been
edited, and next time when the book is opened, I can perform some
processing if the mark is on and then turn off it.


Thanks in advance.


Ting



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default VBA Code Change

The two macros below allow you to check for the date a file was last
modified. Don't know if that will help you with what you are trying to do,
but you can make that evaluation. The short macro is used to activate the
longer one. Just substitute your actual file name for the value of fName.

Sub getdate()
fName = "YourFileName.xls"
ShowFileAccessInfo (fName)
End Sub

Sub ShowFileAccessInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(filespec) & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"
End Sub

" wrote:

No, I permit source code change, instead of protecting it.

In VBA project, some constants are defined, which serve as
configuration purpose. When configuration changes, I need
to do something like re-formatting in the workbook the next time
it is opened (according to the new configuration).

So the most expected behaviour is that some mark can be done
"automatically" once VBA project is changed.

Ting


On Mar 19, 12:23 pm, JLGWhiz
wrote:
Why not just protect your code to prevent changes. In the VB editor,
ToolsVBAProjectPropertiesProtect

You can set a password to prevent unauthorized changes by most users.
Of course, passwords can be overcome by astute users, but it would be
effective against most.

" wrote:
Hello,


Is is possible to detect the code change happened to VBA project? Or
something like "save" event of VBA project (not workbook)?


I intend to leave a mark in worksheet cells if VBA code has been
edited, and next time when the book is opened, I can perform some
processing if the mark is on and then turn off it.


Thanks in advance.


Ting



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
Code to change code in a sheet and workbook module Otto Moehrbach Excel Programming 11 November 11th 07 07:20 PM
Change code with code? CLR Excel Programming 2 April 25th 07 07:40 PM
Change code by code. Can you do that? Corey Excel Programming 2 March 1st 07 12:52 AM
Can I use code/macro to change code/macro in an existing file? Scott Bedows Excel Programming 2 February 14th 07 05:50 AM
Code Conflicts With Worksheet Change Code Paige Excel Programming 3 March 3rd 06 04:25 PM


All times are GMT +1. The time now is 03:23 PM.

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"