Results 1 to 5 of 5

Retrieving the path of my PnP device using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    02-26-2020
    Location
    France
    MS-Off Ver
    Office 365
    Posts
    3

    Retrieving the path of my PnP device using VBA

    Hello everyone !

    So I'm working on a macro that has to retrieve the path of my PnP device in order to run a .bat file. To call the bat file I use the Shell() function. Both of the doc (containing the macro) and the .bat are in the said PnP device.

    Before sending my doc and the bat to the my USB key, I tried it on my PC and everything runned smoothly. Since everything is on the key I can still retrieve the path (as shown in the code down bellow) but the bat file doesn't run because Shell() doesn't find the script.

    So hum... yeah... how can I get a valid path to the .bat for Shell() to run ?

    Private Sub Document_Open()
    
    ' Declaring mandatory variables
    
        Dim filePath As String
        Dim PID As Double
        
    ' Getting the path to the .bat
        ' filePath = ActiveDocument.Path & "\CP.bat"
        filePath = ".\USB_Campaign\CP.bat"
        MsgBox filePath
        
        PID = Shell(filePath, vbNormalFocus)
    
    End Sub
    As you can see I tried different methods to retrieve the path in hope it would be accepted by Shell() (Spoiler : it was no use :p).
    I hope my explanation was clear enough.

    Looking forward to your answer !

    PS : it's my first post on this forum, so tell me if I should post that somewhere else. Plus : I didn't find any thread discussing that particular question, but if I'm wrong I'd be more than happy to check it out
    Last edited by Bigard; 02-27-2020 at 08:36 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using Excel File one device.
    By mazadb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2020, 05:39 PM
  2. Save to a USB device
    By labennett in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-25-2019, 05:00 AM
  3. Excel file use only one Device
    By mazadb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-30-2019, 05:08 AM
  4. In/Out Device tracking system
    By rogersjoe in forum Excel General
    Replies: 1
    Last Post: 11-19-2018, 01:58 AM
  5. [SOLVED] Retrieve USB Disk Device ID
    By freeofcost in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-20-2014, 03:43 PM
  6. EXT engaging when using an external 10-key device
    By Big TR in forum Excel General
    Replies: 1
    Last Post: 05-02-2007, 08:28 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1