Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8465655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:06:46+00:00 2026-06-10T15:06:46+00:00

My vb macro monitors the folder path for new file creation.I can able to

  • 0

My vb macro monitors the folder path for new file creation.I can able to monitor the paths in local drive.
How to provide the path for network drive???

here is my code below.here strDirToMonitor is the place i need to give a network path (\share\files)

But the \ is not working ..

strComputer = "."
strDirToMonitor = "c:\\\\test"
'// Monitor Above every 10 secs...
strTime = "10"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceOperationEvent WITHIN " & strTime & " WHERE " _
    & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
        & "TargetInstance.GroupComponent= " _
            & "'Win32_Directory.Name=" & Chr(34) & strDirToMonitor & Chr(34) & "'")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:06:48+00:00Added an answer on June 10, 2026 at 3:06 pm

    A network path is specified as follows: \\COMPUTUER_NAME\SHARE\PATH. Obviously, you’d need to escape (double) the backslashes as you’d do with a local path

    However, there are some differences in what you can do with network and local paths as remote ones aren’t controlled by your local machine – so I’m not sure if what you’re trying to accomplish will work.

    Edit: As discussed in comments…

    strComputer = "CompB"
    strDirToMonitor = "c:\\\\test"
    '// Monitor Above every 10 secs...
    strTime = "10"
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    
    Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
    ("SELECT * FROM __InstanceOperationEvent WITHIN " & strTime & " WHERE " _
        & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
            & "TargetInstance.GroupComponent= " _
                & "'Win32_Directory.Name=" & Chr(34) & strDirToMonitor & Chr(34) & "'")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a macro that I can use like this: CREATE_URL(@{SOME-TOKEN}/some/url/path); The macro should
I have a macro setup to automatically open/save a file that I am opening
I have a macro that passes the line number and file name to an
I have written a macro to dump excel cells on to a notepad file.
Trying to run a macro in Excel to remove non dupes so dupes can
I have recorded this macro. It's for inserting a chart. How can I create
If I have a macro like: #define MAX_SIZE ((1<<18)-1) I can rest assured that
Can a macro be written in Scheme (with define-syntax , for example) which will
What MACRO can be used to switch off printf statements, rather than removing them
The TRACE macro can be used to output diagnostic messages to the debugger when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.