Oops, the colon is causing the problem. Replace it in the Format() function
with something else that suits your fancy.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"dakke" <(E-Mail Removed)> wrote in message
news:0F9005A1-30E0-4868-8B55-(E-Mail Removed)...
> Thanks for the reply.
>
> I'm not familar with macro's, but this is the error I got:
> Run-time error '5152';
> This is not a valied file name.
> Try on of the following:
> * Check the path to make sure it was typed correctly.
> * Select a file from the list of files and folders.
> (test16-1-2008 02:47 PM)
>
>
> Here's the macro I created based on your advice:
>
> Sub Filesave()
> Dim fname As String
> fname = InputBox("Enter the filename", "File Save As")
> With ActiveDocument
> .Variables("varfname").Value = fname
> .SaveAs fname & Format(Now(), "dd-M-yyyy hh:mm AMPM")
> End With
> End Sub
>
> Sub FilesaveAs()
> End Sub
> With ActiveDocument
> .SaveAs .Variables("varfname").Value & Format(Now(), "dd-M-yyyy hh:mm AMPM
> ")
> End With
> End Sub
>
> So I think it kinda does a thing that comes close, but...
> It also pops up a window asking to 'Enter the filename', which it shouldnt
> do ideally since it should take the 'actual' filename and simply update
> the
> date and time. Should have been more clear on this. However, entering the
> filename does not work: 'test', 'test.doc' doesn't do a thing.
> Is there a way to do this (might be useful to create a field with the
> title
> like 'test' and that the macro grabs the field and adds the data and time)
>
> Your help is much appreciated, but also points out that I really need to
> learn more about the macro's.
|