?
Solved

Refresh Folder Drives with VBA

Posted on 2013-06-20
8
Medium Priority
?
1,522 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
[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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
New style of hardware planning for Microsoft Exchange server.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
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…

718 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