VBA FileCopy hangs with UAC

  • Thread starter Thread starter FPS, Romney
  • Start date Start date
F

FPS, Romney

Hi all,

situation:
LAN, with a shared folder on an XP machine. The Vista (Home Premium) user
has full privileges to this shared folder and otherwise has no problems
reading/writing/copying etc. to this folder.

For a particular routine, however, I have VBA code within a Microsoft Access
database which is run on the Vista computer and which uses the FileCopy
command to copy a file from the network shared folder to the Vista user's
root directory (C:\). This operation fails with UAC turned on; it works fine
with UAC turned off.

I'm guessing it's a permissions issue, but don't know how to set it up so
that FileCopy would work even with UAC turned on.

Thanks for any suggestions.
Mark
 
FPS said:
Hi all,

situation:
LAN, with a shared folder on an XP machine. The Vista (Home Premium) user
has full privileges to this shared folder and otherwise has no problems
reading/writing/copying etc. to this folder.

For a particular routine, however, I have VBA code within a Microsoft
Access
database which is run on the Vista computer and which uses the FileCopy
command to copy a file from the network shared folder to the Vista user's
root directory (C:\). This operation fails with UAC turned on; it works
fine
with UAC turned off.

I'm guessing it's a permissions issue, but don't know how to set it up so
that FileCopy would work even with UAC turned on.

Thanks for any suggestions.

You figure out how to execute this solution using Run As Administrator, from
a short-cut or off the exe Properties, as an example, or somehow you
incorporate into your program solution the usage of the UAC Manifest the
will again present the Run As Administrator credentials to Vista for the
program..
 
Thanks for the suggestions, Mr. Arnold
....
Run As Administrator is not listed as an option for either the shortcut, or
the actual file (a Microsoft Access database file). The user logs on with
Administrator privileges. So, I don't know if Microsoft Access database
files have Run As Administrator applied by default, or what. Interestingly,
a shortcut to Windows Explorer does have Run As Administrator listed as an
option.

I didn't understand your second option -- "the usage of the UAC Manifest the
will again present the Run As Administrator credentials to Vista for the
program", but I'm guessing this wouldn't work in this situation anyway. The
database in question undergoes frequent revisions and then is sent out to
users with different operating systems. It would be very cumbersome to have
different code for different operating systems.
 
FPS said:
Thanks for the suggestions, Mr. Arnold
...
Run As Administrator is not listed as an option for either the shortcut,
or
the actual file (a Microsoft Access database file). The user logs on with
Administrator privileges. So, I don't know if Microsoft Access database
files have Run As Administrator applied by default, or what.
Interestingly,
a shortcut to Windows Explorer does have Run As Administrator listed as an
option.

No, the Access database file doesn't have Run as Administrator by default,
as you can see. The MDB file is not an executable.
I didn't understand your second option -- "the usage of the UAC Manifest
the
will again present the Run As Administrator credentials to Vista for the
program", but I'm guessing this wouldn't work in this situation anyway.
The
database in question undergoes frequent revisions and then is sent out to
users with different operating systems. It would be very cumbersome to
have
different code for different operating systems.

Well, you can't expect code that runs on the XP platform is going to work on
Vista without change. However, I also would assume the VBA solution is ran
after the user starts Access, which does have a MSaccess.exe that would have
the Run on Administrator on its properties, which only applies to
executables.
 
Thanks for the clarification, Mr. Arnold.
You're correct that the code runs after Access starts. The user is running
with Administrator privileges; Access (MSaccess.exe/Office Pro 2007) opens
fine, and all the other VBA (XP) code runs fine. There's no problem with the
frontend database on the Vista computer importing data/records from an
outside source via VBA code -- it's only on the FileCopy command that it
hangs when it tries to copy a file from the outside source to the local root
directory (C:\).

Using Windows Explorer, I could not manually copy from the outside source to
the local root directory (C:\) with UAC on ... receiving a message that I
did not have sufficient privileges, even though I was logged on with
Administrator rights. I tried increasing those rights to full privileges,
which seemed to happen I guess for most files and folders under the root
directory, but there were certain files and folders that I was informed I
could not have full privileges.

I turned off UAC and had no problem manually copying the file from the
outside source to the local root directory (C:\)

Mark
 
FPS said:
Thanks for the clarification, Mr. Arnold.
You're correct that the code runs after Access starts. The user is running
with Administrator privileges; Access (MSaccess.exe/Office Pro 2007) opens
fine, and all the other VBA (XP) code runs fine. There's no problem with
the
frontend database on the Vista computer importing data/records from an
outside source via VBA code -- it's only on the FileCopy command that it
hangs when it tries to copy a file from the outside source to the local
root
directory (C:\).

Using Windows Explorer, I could not manually copy from the outside source
to
the local root directory (C:\) with UAC on ... receiving a message that I
did not have sufficient privileges, even though I was logged on with
Administrator rights.

Admin with UAC enabled locks down the Admin user account to Standard user in
most cases where the Admin account must have its privileges escalated.

I tried increasing those rights to full privileges,
which seemed to happen I guess for most files and folders under the root
directory, but there were certain files and folders that I was informed I
could not have full privileges.

I turned off UAC and had no problem manually copying the file from the
outside source to the local root directory (C:\)

Maybe, it will slove your problem.

<http://www.computerperformance.co.u...a_Administrator_-_Super_User_(Hidden_Account)>
 
you said:
Admin with UAC enabled locks down the Admin user account to Standard user in
most cases where the Admin account must have its privileges escalated.
.... that might be it. I'll try your link for switching to "super user".
Thanks,
Mark
 
Back
Top