How to file export to a specifc NT User Profile

Hello,

I have an button on a view that exports the data from a document to an excel file. The problem is that I wish to export it to the My documents folder of the person logged onto the machine. I am using formula language but I do not do the code. I am not restricted to using Formula code so if it can be done in Lotus script that would be great. Any help on this would be greatly appreciated.

Here is the code I have so far,

@Prompt([Ok];“Export”;“The selected data will be exported to a file called Mailing.xls into your My Documents Folder. You can then use the spreadsheet data to perform the Mail Merge.”);

@Command([FileExport];“Tabular Text”;“C:\Documents and Settings\%Userprofile%\Desktop\Mailing.xls”);

@PostedCommand( [Execute]; “C:\Program Files\Microsoft Office\Office11\EXCEL.EXE”;“C:\Documents and Settings\%Userprofile%\Desktop\Mailing.xls”)

I the %Userprofile% is the section of code I need the help on . If I put in All Users it works fine and the file is created in the All users My Documents but it has to be created in the profile of the user logged onto the machine.

Thanking you in advance,

Laura

Subject: How to file export to a specifc NT User Profile

Try using:

MyXLS := @Environment(“USERPROFILE”) +

“\My Documents\Mailing.xls”;

and then using MyXLS.

You may have to replace the single "" in the @Environment section with double "".

Subject: RE: How to file export to a specifc NT User Profile

Hi there,

Thank you for your suggestion. I have tried your suggestion but it does not seem to work for me.

I presume from looking on the internet that the USERPROFILE would have to be declared in the notes.ini file on the local machine which it is not. However we have a declaration for FileDlgDirectory that points to the specific users Desktop. So we could use this Variable. I tried this but it also will not work .

I put in some code as follows:

@Prompt([Ok];“Export”;“The selected data will be exported to a file called Mailing.xls on your desktop. You can then use the spreadsheet data to perform the Mail Merge.”);

MyXLS := @Environment(“FileDlgDirectory”);

@Prompt([Ok];“”;MyXLS);

@Command([FileExport];“Lotus 1-2-3”;MyXLS+ “\Mailing.xls”);

@PostedCommand( [Execute]; “C:\Program Files\Microsoft Office\Office11\EXCEL.EXE”;MyXLS+ “\Mailing.xls”)

The Output from the line

@Prompt([Ok];“”;MyXLS);

is a blank.

It seems like the code is working and it does to an extent except that the Mailing.xls file gets saved to the root of the domino server. We definitely don’t want that.

Any more help would be great,

Thanks,

Laura

Subject: How to file export to a specifc NT User Profile

Laura,

From a DOS prompt type ‘set’ and this will show you all of your OS system variables that you can access via %SystemVariable%.

Your issue is that %UserProfile% already contains the string:

“c:\Documents and Settings\CurrentUser”

so you are in essence passing in this:

C:\Documents and Settings\C:\Documents and Settings\Currentuser\Desktop\Mailing.xls

You can use either:

“C:\Documents and Settings\%UserName%\Desktop\Mailing.xls”

or:

%UserProfile%\Desktop\Mailing.XLS"

Either of these should work to accomplish what you are trying to do.

Good Luck,

Shawn

Subject: RE: How to file export to a specifc NT User Profile

Hi Shaw,

Thank you for your suggestion. I tried both your options and for both I just get File Could Not be Created Error.

I dont think I pointed out earlier on that this code is in an action button in a view. I select the documents and then choose to do the export.

I really cannot see what I am doing wrong. Could you please help me again.

Here is my code on the button:

@Prompt([Ok];“Export”;“The selected data will be exported to a file called Mailing.xls on your desktop. You can then use the spreadsheet data to perform the Mail Merge.”);

@Command([FileExport];“Lotus 1-2-3”;“%UserProfile%\Desktop\Mailing.XLS”);

@PostedCommand( [Execute];“C:\Program Files\Microsoft Office\Office11\EXCEL.EXE”;“%UserProfile%\Desktop\Mailing.XLS”)

I also wrote it so that the %UserProfile" was outside the brackets but that also did not work.

I hope you can help me.

Thanks,

Laura

Subject: RE: How to file export to a specifc NT User Profile

Luara what happens if code this in your view action?

@Command([FileExport]; “Tabular Text”; “C:\Mailing.XLS”);

Shawn

Subject: RE: How to file export to a specifc NT User Profile

Hi Shawn, That works fine but it will only work for administrators because our general users are restricted from saving to the root of the C drive.

Laura

Subject: RE: How to file export to a specifc NT User Profile

Laura,

I think the issue here is you can’t (That I know of) access the OS system variables through formula language.

You can in script like this:

Dim userPath as String

userPath = Environ(“%UserProfile%”) ’ grabs the path

That would set userPath to the exacth path you want. However I can’t find a way in help to do the same in formula.

Shawn

Subject: RE: How to file export to a specifc NT User Profile

Thanks for you help. I will give that a go.

Laura