[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

vba fso

Posted on 2013-06-11
2
Medium Priority
?
414 Views
Last Modified: 2013-06-11
Hello,

Need a robust vba code that does this.

There is a network folder called gdfgf/fdsfsdf which has a particular csv file.
1.      Create a folder (if it doesn’t exist in C drive by the name: C:\newTemp
2.      Copy the target csv from the network folder and dump it in the newly created folder (C:\newTemp)
3.      Do some stuff with the csv (code not needed for this step)
4.      Delete the folder that has the csv

Thank you
0
Comment
Question by:Rayne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 39238787
Assuming your user acct has the right permissions...


Dim fso, fil, fld

Set fso = CreateObject("Scripting.FileSystemObject")

On Error Resume Next

Set fil = fso.GetFile("\\servername\share\folder\subfolder\blah.csv")
' Set fil = fso.GetFile("\\servername\c$\folder\subfolder\blah.csv")

If Err <> 0 Then
    MsgBox "blah.csv does not exist"
Else
    Set fld = fso.GetFolder("c:\newTemp")
    If Err <> 0 Then fso.CreateFolder("c:\newTemp")
    fil.Copy "c:\newTemp\blah.csv", True
    ' do stuff to file
    fld.Delete True
End If

Set fil = Nothing
Set fld = Nothing
Set fso = Nothing

On Error GoTo 0

Open in new window

0
 

Author Comment

by:Rayne
ID: 39238910
Thanks Patrick :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question