Solved

Refresh Folder Drives with VBA

Posted on 2013-06-20
8
1,232 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 45

Expert Comment

by:aikimark
ID: 39266048
you might try issuing a Net Use command from your VBA code.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Rayne
ID: 39266966
Hello Aikimark,

Can you give an example?
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now