Solved

Refresh Folder Drives with VBA

Posted on 2013-06-20
8
1,266 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

813 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

16 Experts available now in Live!

Get 1:1 Help Now