Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Refresh Folder Drives with VBA

Posted on 2013-06-20
8
Medium Priority
?
1,581 Views
Last Modified: 2013-11-11
Hello,
I am dealing with share network drives and SharePoint folders – where I need to grab and put files. In order to make sure that the SharePoint physical folder link is working – I always try to refresh the link before I call macros from excel.
The thing I do – open My Computer and hit F5 which in turn refreshes all the network drives.
Doing the same in VBA with shell? Or I don’t know. How the same thing be done in VBA  so that it will refresh the network drive and SharePoint folder?
0
Comment
Question by:Rayne
  • 5
  • 2
8 Comments
 

Author Comment

by:Rayne
ID: 39263837
or just a shell to open my computer and send keys f5 - possible??
0
 

Author Comment

by:Rayne
ID: 39263840
that could be done with macro??
0
 
LVL 46

Expert Comment

by:aikimark
ID: 39266048
you might try issuing a Net Use command from your VBA code.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:Rayne
ID: 39266966
Hello Aikimark,

Can you give an example?
0
 
LVL 46

Accepted Solution

by:
aikimark earned 2000 total points
ID: 39267013
The simplest way would be to use a Shell() function/statement.  I do not know if you will have to execute CMD.EXE or %COMSPEC% as part of the command or if you will be able to just execute the "Net USE" command with the Shell() function.

However, the VB code would not wait until the Net Use command finishes.  To address that issue, you should instantiate a wscript.shell object variable and use its .RUN method.  There is a .RUN() method with such objects and it has a wait parameter.  This facilitates your program waiting for the command to finish before continuing.
0
 

Author Comment

by:Rayne
ID: 39267084
thank you Aikimark :)
0
 

Author Comment

by:Rayne
ID: 39638100
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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

927 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