View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default Putting A Macro in a Cell

Look at Jim Cone's solution below - spot on answer for you! I worked out a
way using Scripting and the FileSystemObject, but his solution is much
cleaner and probably the way to go. To adapt it for your setup, you'd put
=When(E2)
into cell H2, and you can drag/fill the formula on down the sheet as far as
you need to go.

"Jeff W." wrote:

OK, the name of the work book is "work log 2007.xls"
The name of the file/hyperlink in always in column "E"
The date of the hyperlinked file will always be in column "H"

I guess maybe having update the cell every time file date
changes may be too much to expect, maybe I could have it run
through and update these fields on the opening of the work book only

I suppose this would be fine, and I think probably easier.

Anything you could do to help would be appreciated greatly...

Thanks,

Jeff W.


"JLatham" <HelpFrom @ Jlathamsite.com.(removethis) wrote in message
...
Well, you're not easily going to get this updated each time the Word file
gets changed - Excel has no direct way of knowing when Word did something.

But the information you need is all the the hyperlink to the file will
contain the path to that file and that gives Excel something to work
with -

Given that we can now determine where the Word file is, you have a couple
of
options on how to get its last updated date into column G. You could set
up
some VBA code in the workbook's _Open() event handler that would go down
through which ever column you have the hyperlink in (that's not clear from
your example), and get the dates and put them in the appropriate row,
column
G. A second option is much the same - but the code would be associated
with
some worksheet action - such as activating it (but if it's the only sheet
in
the workbook, that's not a good choice - the _Activate event doesn't fire
until that sheet is selected, and being the active sheet when the workbook
opens doesn't count). Third option is to have the same code working from
an
"on demand" button on the sheet that you'd click when you wanted the
information updated.

To get this going, it would be very helpful to know the name of this
worksheet and the column with the hyperlinks in it. Meanwhile, I've got
to
go dig around in my "file info" information and remember how to code up
digging out the file date from a disk file...

"Jeff W." wrote:

I have a work log that I use to track my daily projects that is an excel
sheet
and in the fifth column I have the customers name which I have hyper
linked
to a WORD document that is in a specific directory I would like to have
eighth
cell on that same line show the saved date of the WORD file with the name
of
the
hyperlinked file this is one line of my log.

-A- -B- -C- -D- -E-
-F- -G-
-H-
(status) (item) (entry date) (invoice) (customer) (project)
(comments) (updated)
Closed 10 05/08/07 2398057 Franklin Band Saw
Post
Waiting For response "the date of the word file"

If I could do this I can look at a glance and see the date of the last
activity based on the file date of the hyperlinked WORD document

All the word documents are in the same folder, I add items to this
everyday,
so the rows across just keep accumulating
I don't know if its possible to have it do this automatically update cell
"H" every time the word file gets changed so I would
always have up to date information

I'm open to suggestions, I just don't know how to get this macro in a
cell,
I mean if this is even the way this should be done

Thanks,

Jeff W.