The following code works fine but when I "ChDir "C:\" I get a file/path error
I declared C drive as a trusted source with no results.Please Login or Register to view this content.
How can I negotiate files directly to C drive?
The following code works fine but when I "ChDir "C:\" I get a file/path error
I declared C drive as a trusted source with no results.Please Login or Register to view this content.
How can I negotiate files directly to C drive?
Turn Data into Information
Turn Information into Knowledge
Turn Knowledge into Direction
Turn Direction into Leadership
Turn Leadership into Results
Stephen Druley
It's not how quickly you think
But how deeply you think
The quality of thinking is measured
by remoteness to conformance
Stephen Druley
Not sure you can these days ... but it's a Windows issue rather than an Excel problem (I think).
I have Windows 7 and find that I can't create files in the root of the C: drive. I suspect this is to prevent corruption and to minimise the impact of viruses, etc.
I've settled for having a sub-folder on the C: drive which I can access and create and delete files. If, in Windows Explorer, I open the C: drive and right click, the only option I get is to create a folder, nothing else. Equally, if I create a .txt file with Notepad and try to save it to the C: drive I get a message to the effect that I do not have permission and to contact the Administrator. If I run Notepad as Administrator, I can save my file to the C: drive.
Hope this helps
Regards, TMS
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
You shouldn't use chdir in VBA.
because it's not clear what is in 'Efile'
in your case it could be
Please Login or Register to view this content.
@snb: I suspect the issue is not whether or not to use ChDir, but the fact that you need to be in Admin mode to write to the C: drive, full stop.
Might be a registry hack to get round it but that would probably put the system at risk.
Regards, TMS
It will depend on where on the C drive you are writing, but as snb said, ChDir is rarely necessary. if you do use it, you should always use ChDrive first anyway.
Remember what the dormouse said
Feed your head
Is this for work or home use - if you ADMIN should be basic code, the change DIR stuff is and CMD window you can just line code the target in VBA as has been expressed already (not picking just stating)
if work speak with IT in case some funky stuff going on - and remember C might not be C HDD if your profiled out could be more or less anything
Can you see the C root on Windows Explorer, if co can you manually test / open the file?
Xp will be fine and if you can the code will work, if not, you got a problem
See what you come back with and maybe a MOD will move this to Windows forum not sure your version
Se7en Pro (x64) and Ultimate (x68) are OK to write to the but not the C root you can add a folder and dump the files in there, but not add direct to the boot partition, Xp however You can - i assume X86 flavours are the same as X86
Thank you gentlemen,
I have followed the snb recommended format and have ridded the program of chdir syntax.
We are still getting run time error 75 stating "Path/File Access error".
I am using Excel 2010 64bit in Windows 7 and I am the administrator. We have the ability to do whatever is needed but don't know what that might be.
C: root is clearly visible. In attempting to manually move the EFile to the root it will engage the "You will have to provide administrative approval" dialog box.
I tested
in Excel 2010, Windows XP. No problem arises.Please Login or Register to view this content.
See:
http://answers.microsoft.com/en-us/w...c-b4c1aca35aaf
Or just Google "accessing c drive in windows 7"Indeed, there is a change in Windows 7 with regard to sharing the C drive. The default security template no longer include "Everyone," which is not the case in Vista.
In order to share C drive with no authentication, you have to add "Everyone" to Security.
Maybe this will resolve your problem.
Regards
Okay, here is an update:
I followed Mr Shucks advise and still nothing. I created the files successfully on a directory named C:\TTND and it worked but I need the files on C drive root. So I wrote code to move the files from C:\TTND to C:\ and I got a permission denied error.
My ability to use Ninja Trader depends on two things:
1) Finding the appropriate .txt files on C root
2) Being able to "bat" the files over to the directory C:\Users\Steve\Documents\NinjaTrader 7\incoming
Using vba to send the files directly to C:\Users\Steve\Documents\NinjaTrader 7\incoming does not work with Ninja since the time required to release the file to the directory is too long.
I talked to the people at Ninja and they suggested two things:
1) Goto cmd.exe and specify "Run as Administrator"
2) Build a "Run as Administrator" parameter into the bat run syntax
I have no clue how to do either of these things.
Steve
Have you tried turning off UAC?
So you ar looking for a solution to this problem:
We could try to solve that before inventing a 'workaround'.Using vba to send the files directly to C:\Users\Steve\Documents\NinjaTrader 7\incoming does not work with Ninja since the time required to release the file to the directory is too long.
What VBA-method do you use to send the file directly to 'C:\Users\Steve\Documents\NinjaTrader 7\incoming' ?
To romperstomper: UAC configuration did not help
To snb: Since I was told that this is not possible to do by Ninja, I did not formulate any specific code. But then, they didn't know that snb was involved. If I could write the files directly to the "incoming" directly, I would be delighted. What code would you propose? This would be so simple if it worked.
Thanks to everyone for their help.
Steve
Where does the Ninja file reside ?
snb
just make up a txt file and send it to the incoming directory. That should suffice.
Please Login or Register to view this content.
snb,
This code looks clean and fast. I will try it this weekend. I have to go in for a medical procedure
steve
Open Excel with administrator rights.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks