Jump to content

VBA FileCopy hangs with UAC


Recommended Posts

Guest FPS, Romney
Posted

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

  • Replies 6
  • Created
  • Last Reply
Guest Mr. Arnold
Posted

"FPS, Romney" <fpswv@citlink.net> wrote in message

news:%236%23xID04IHA.3804@TK2MSFTNGP03.phx.gbl...<span style="color:blue">

> 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.</span>

 

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..

Guest FPS, Romney
Posted

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.

 

"Mr. Arnold" <MR. Arnold@Arnold.com> wrote in message

news:%239QohF24IHA.4272@TK2MSFTNGP03.phx.gbl...<span style="color:blue">

>

> "FPS, Romney" <fpswv@citlink.net> wrote in message

> news:%236%23xID04IHA.3804@TK2MSFTNGP03.phx.gbl...<span style="color:green">

> > Hi all,

> >

> > situation:

> > LAN, with a shared folder on an XP machine. The Vista (Home Premium)</span></span>

user<span style="color:blue"><span style="color:green">

> > 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</span></span>

user's<span style="color:blue"><span style="color:green">

> > 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</span></span>

so<span style="color:blue"><span style="color:green">

> > that FileCopy would work even with UAC turned on.

> >

> > Thanks for any suggestions.</span>

>

> You figure out how to execute this solution using Run As Administrator,</span>

from<span style="color:blue">

> 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..

></span>

Guest Mr. Arnold
Posted

"FPS, Romney" <fpswv@citlink.net> wrote in message

news:ubHnh324IHA.4908@TK2MSFTNGP04.phx.gbl...<span style="color:blue">

> 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.</span>

 

No, the Access database file doesn't have Run as Administrator by default,

as you can see. The MDB file is not an executable.

<span style="color:blue">

>

> 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.</span>

 

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.

 

 

 

<span style="color:blue">

>

> "Mr. Arnold" <MR. Arnold@Arnold.com> wrote in message

> news:%239QohF24IHA.4272@TK2MSFTNGP03.phx.gbl...<span style="color:green">

>>

>> "FPS, Romney" <fpswv@citlink.net> wrote in message

>> news:%236%23xID04IHA.3804@TK2MSFTNGP03.phx.gbl...<span style="color:darkred">

>> > Hi all,

>> >

>> > situation:

>> > LAN, with a shared folder on an XP machine. The Vista (Home Premium)</span></span>

> user<span style="color:green"><span style="color:darkred">

>> > 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</span></span>

> user's<span style="color:green"><span style="color:darkred">

>> > 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</span></span>

> so<span style="color:green"><span style="color:darkred">

>> > that FileCopy would work even with UAC turned on.

>> >

>> > Thanks for any suggestions.</span>

>>

>> You figure out how to execute this solution using Run As Administrator,</span>

> from<span style="color:green">

>> 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..

>></span>

>

> </span>

Guest FPS, Romney
Posted

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

 

 

"Mr. Arnold" <MR. Arnold@Arnold.com> wrote in message

news:%23wTrhhF5IHA.1196@TK2MSFTNGP05.phx.gbl...<span style="color:blue">

>

> "FPS, Romney" <fpswv@citlink.net> wrote in message

> news:ubHnh324IHA.4908@TK2MSFTNGP04.phx.gbl...<span style="color:green">

> > 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</span></span>

with<span style="color:blue"><span style="color:green">

> > 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</span></span>

an<span style="color:blue"><span style="color:green">

> > option.</span>

>

> No, the Access database file doesn't have Run as Administrator by default,

> as you can see. The MDB file is not an executable.

><span style="color:green">

> >

> > 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</span></span>

to<span style="color:blue"><span style="color:green">

> > users with different operating systems. It would be very cumbersome to

> > have

> > different code for different operating systems.</span>

>

> Well, you can't expect code that runs on the XP platform is going to work</span>

on<span style="color:blue">

> 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</span>

have<span style="color:blue">

> the Run on Administrator on its properties, which only applies to

> executables.

>

>

>

><span style="color:green">

> >

> > "Mr. Arnold" <MR. Arnold@Arnold.com> wrote in message

> > news:%239QohF24IHA.4272@TK2MSFTNGP03.phx.gbl...<span style="color:darkred">

> >>

> >> "FPS, Romney" <fpswv@citlink.net> wrote in message

> >> news:%236%23xID04IHA.3804@TK2MSFTNGP03.phx.gbl...

> >> > Hi all,

> >> >

> >> > situation:

> >> > LAN, with a shared folder on an XP machine. The Vista (Home Premium)</span>

> > user<span style="color:darkred">

> >> > has full privileges to this shared folder and otherwise has no</span></span></span>

problems<span style="color:blue"><span style="color:green"><span style="color:darkred">

> >> > 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</span></span></span>

FileCopy<span style="color:blue"><span style="color:green"><span style="color:darkred">

> >> > command to copy a file from the network shared folder to the Vista</span>

> > user's<span style="color:darkred">

> >> > root directory (C:). This operation fails with UAC turned on; it</span></span></span>

works<span style="color:blue"><span style="color:green"><span style="color:darkred">

> >> > fine

> >> > with UAC turned off.

> >> >

> >> > I'm guessing it's a permissions issue, but don't know how to set it</span></span></span>

up<span style="color:blue"><span style="color:green">

> > so<span style="color:darkred">

> >> > 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,</span>

> > from<span style="color:darkred">

> >> 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</span></span></span>

the<span style="color:blue"><span style="color:green"><span style="color:darkred">

> >> will again present the Run As Administrator credentials to Vista for</span></span></span>

the<span style="color:blue"><span style="color:green"><span style="color:darkred">

> >> program..

> >></span>

> >

> ></span>

></span>

Guest Mr. Arnold
Posted

"FPS, Romney" <fpswv@citlink.net> wrote in message

news:eaXMWdb5IHA.4448@TK2MSFTNGP05.phx.gbl...<span style="color:blue">

> 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.</span>

 

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.

 

<span style="color:blue">

>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:)

></span>

 

Maybe, it will slove your problem.

 

<http://www.computerperformance.co.uk/vista/vista_administrator_activate.htm#Summary_of_Vista_Administrator_-_Super_User_(Hidden_Account)>

Guest FPS, Romney
Posted

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

 

"Mr. Arnold" <MR. Arnold@Arnold.com> wrote in message

news:uYQ42od5IHA.3768@TK2MSFTNGP02.phx.gbl...<span style="color:blue">

>

> "FPS, Romney" <fpswv@citlink.net> wrote in message

> news:eaXMWdb5IHA.4448@TK2MSFTNGP05.phx.gbl...<span style="color:green">

> > Thanks for the clarification, Mr. Arnold.

> > You're correct that the code runs after Access starts. The user is</span></span>

running<span style="color:blue"><span style="color:green">

> > with Administrator privileges; Access (MSaccess.exe/Office Pro 2007)</span></span>

opens<span style="color:blue"><span style="color:green">

> > 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</span></span>

source<span style="color:blue"><span style="color:green">

> > to

> > the local root directory (C:) with UAC on ... receiving a message that</span></span>

I<span style="color:blue"><span style="color:green">

> > did not have sufficient privileges, even though I was logged on with

> > Administrator rights.</span>

>

> Admin with UAC enabled locks down the Admin user account to Standard user</span>

in<span style="color:blue">

> most cases where the Admin account must have its privileges escalated.

>

><span style="color:green">

> >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</span></span>

I<span style="color:blue"><span style="color:green">

> > 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:)

> ></span>

>

> Maybe, it will slove your problem.

>

></span>

<http://www.computerperformance.co.uk/vista...or_activate.htm

#Summary_of_Vista_Administrator_-_Super_User_(Hidden_Account)><span style="color:blue">

></span>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...