PDA

View Full Version : How to open a secured directory



Ablah
10-13-2009, 02:37 AM
Hey there, I have a question. In excel I make a .txt file, so I can bulk insert it into my sql table. However Sql can't take this file out of my harddisk and excel can't put in into the server.

Now I am making the txt file on my pc, manually connect to the server and filecopy it at the end of the sub. I was wondering if it s possible to make this connection with Vba, so that I have the permission to copy the file to its directory. Thanks alot in advance!

This is how the story goes, without all the data and other stuf.

Open "c:\doctemp\" & Fname For Output As #1
This is what creates the file.

*I manually connect to the server*

FileCopy "c:\doctemp\" & Fname, "U:\ICAS\Costs.txt"
This is where the file gets copied to my shared server directory.

Then I call the stored procedure to bulk insert the costs.txt in to the table.