Easy way to trap changed cell values upon close?

  • Thread starter Thread starter Rich Wallace
  • Start date Start date
R

Rich Wallace

Hi all,

I have a project written in VB.NET that ultimately traps a workbook upon the
save function and writes its contents out to an XML document.
Unfortunately, I don't have enough flexability to limit the data I want to
extract at this point so I wandered on over here to see if the Masters may
be able to help me.

What I would like to do, if at all possible or if other options are
available is the following:

When a user saves a workbook/active worksheet, is there a way I can locate
what cells were changed since the last save/open of the file? .NET provides
an event handler that would allow me to trap individual cell changes but
only if the XLS file is opened within my custom app, seems there are
challenges grabbing onto the Excel instance and attaching to an active
worksheet and applying the event handler outside of the sheet.

One option I thought of was to grab a copy of the file when the user opens
it, then grab another copy of it when they save it and then see if I can run
a cell by cell comparison against the two sheets but this could be complex.

So does anyobdy have any ideas on how I may be able to attack this in either
VBA or VB.NET? Any suggestions would be greatly appreciated.

Thanks,
-Rich
 
within Excels VBA

write function to the classmodule of the sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox CStr(Target.Address)
End Sub

write it to where you need it....

kalle
 
Thanks Kalle,

I can see where this would work if I my app was written in VBA and within
the worksheets in question. However, my situation requires me to manage
many different files outside of the Excel world so I was hoping to find a
way to either look for anything in the worksheet similar to the Track
Changes, but all behind the scenes and without actually activating the Track
Changes on every file.

Is there nothing similar to a versioning component that I can dig into to
see the cells that were different? I'd love to go to an event driven
solution and I did try that several times from my VB app, but no avail.
Also, anything I cna do as far as the cell be cell comparison between two
saved files?

Thanks again.

-R
 
Nothing built in.

--
Regards,
Tom Ogilvy

Rich Wallace said:
Thanks Kalle,

I can see where this would work if I my app was written in VBA and within
the worksheets in question. However, my situation requires me to manage
many different files outside of the Excel world so I was hoping to find a
way to either look for anything in the worksheet similar to the Track
Changes, but all behind the scenes and without actually activating the Track
Changes on every file.

Is there nothing similar to a versioning component that I can dig into to
see the cells that were different? I'd love to go to an event driven
solution and I did try that several times from my VB app, but no avail.
Also, anything I cna do as far as the cell be cell comparison between two
saved files?

Thanks again.

-R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top