ActiveWorkbook.SaveAs Function - Can I specify the user account tosave the file with

T

TyreDude

Hello,

Can I use the ActiveWorkbook.SaveAs function and include the user
account to save the file as? For example, I want to save the file to a
directory where the user running the macro only has read only access.
This is why I want to specify the account to use (which has full
access), to save the file successfully.

i..e. ActiveWorkbook.SaveAs User: Domain\Name Password: xxxxxxx

Is there a way this can be done?

Thanks,

Brett
 
C

CellShocked

If what you want is to merely determine who last edited the file, you
can examine the file properties for that.
 
G

goshute

Hello,

Can I use the ActiveWorkbook.SaveAs function and include the user
account to save the file as? For example, I want to save the file to a
directory where the user running the macro only has read only access.
This is why I want to specify the account to use (which has full
access), to save the file successfully.

i..e. ActiveWorkbook.SaveAs User: Domain\Name Password: xxxxxxx

Is there a way this can be done?

Thanks,

Brett

Security is based on the user that is signed onto the machine. Change
permissions on the directory so the user can write to the directory,
or re-assign the task to someone that has the necessary permissions.
Goshute
 
T

TyreDude

Security is based on the user that is signed onto the machine.  Change
permissions on the directory so the user can write to the directory,
or re-assign the task to someone that has the necessary permissions.
Goshute

I need Excel to save the file as a different user (i.e. service
account) who has permissions to write to the directory. I cannot re-
assign the task to another user, it is not possible. I just want to
know if Excel can save the file using a different user account. The
user cannot write to the directory as I do not want them to change the
file.
 
G

goshute

I need Excel to save the file as a different user (i.e. service
account) who has permissions to write to the directory.  I cannot re-
assign the task to another user, it is not possible.  I just want to
know if Excel can save the file using a different user account.  The
user cannot write to the directory as I do not want them to change the
file.- Hide quoted text -

- Show quoted text -

I don't think Excel and VBA can do what you want. Permissions to the
directorys are assigned by Windows when the user logs on to the pc not
by the application. Even if more than one user is signed on to a
single pc, each users permissions apply to that user. I can only
guess that this functionality was left out of VBA because of virues
and other malware.

Goshute
 
T

Tim Williams

You could save to a temp location, then shell out to "runas" but it's not
the way to go. You'd have to store the account details in the workbook, and
you have to use sendkeys to enter the password.

Tim


I need Excel to save the file as a different user (i.e. service
account) who has permissions to write to the directory. I cannot re-
assign the task to another user, it is not possible. I just want to
know if Excel can save the file using a different user account. The
user cannot write to the directory as I do not want them to change the
file.- Hide quoted text -

- Show quoted text -

I don't think Excel and VBA can do what you want. Permissions to the
directorys are assigned by Windows when the user logs on to the pc not
by the application. Even if more than one user is signed on to a
single pc, each users permissions apply to that user. I can only
guess that this functionality was left out of VBA because of virues
and other malware.

Goshute
 
T

Tim Williams

....or netuse might be better, since you can just supply the password in the
commandline.

Tim
 

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