Rename an Existing File

M

Martyn Lawson

Hi,

I has successfully used the SetSaveAsDialogFileName() function to specify a
filename. However, I would like to rename the file the next time it is saved
(provided it meets my criteria).

I appears though, that the above function only works when the Save As is
called (either from the toolbar or when creating a new form).

Is there a way to specify the actual filename on the save, rather than the
default one? Or is it possible to change the Save button to actually call the
Save As?

Kind Regards,
Martyn...
 
F

Franck Dauché

Hi Martyn,

Did you try to take over the form Save behavior by code (Tools / Form
Options / Open Save Tab)?

Regards,

Franck Dauché
 
M

Martyn Lawson

Hi Franck,

Yes that is where I am having the problem. I have custom code in the
OnSave() function, but the SetSaveAsDialogFileName() hs not affect on an
existing form and i cannot find the syntax to force a save using a specific
filename.

Any ideas?

Cheers,
Martyn...
 
F

Franck Dauché

Hi Martyn,

Once you have your target filename from the user, did you try to use:
thisApplication.ActiveWindow.XDocument.SaveAs(YourFileName);

Franck Dauché
 
M

Martyn Lawson

Hi Franck,

Thanks again for your reply (and the link to the SDK). These appear to be
using C#? Do you have a solution for JScript?

I have tried using the XDocument.SaveAs(<filename>); but this generates a
'permission denied' error. Does the form need to be fully trusted for this to
work?

If so, is there any other way round this that you can think of? I there a
way to take a copy and rename and then delete the original?

Any suggestions would be greatly appreciated,

Cheers,
Martyn...
 

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

Top