Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1688
  • Last Modified:

Refresh Folder Drives with VBA

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
Rayne
Asked:
Rayne
  • 5
  • 2
1 Solution
 
RayneAuthor Commented:
or just a shell to open my computer and send keys f5 - possible??
0
 
RayneAuthor Commented:
that could be done with macro??
0
 
aikimarkCommented:
you might try issuing a Net Use command from your VBA code.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
RayneAuthor Commented:
Hello Aikimark,

Can you give an example?
0
 
aikimarkCommented:
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
 
RayneAuthor Commented:
thank you Aikimark :)
0
 
RayneAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now