+ Reply to Thread
Results 1 to 4 of 4

How to enter %PC1driveD% into .vbs? System environment variable PC1DriveD defined as d:

  1. #1
    Registered User
    Join Date
    08-30-2014
    Location
    Lake Worth, Florida
    MS-Off Ver
    Office 2010
    Posts
    2

    How to enter %PC1driveD% into .vbs? System environment variable PC1DriveD defined as d:

    PC2 needs to access the files on PC1,
    thus sysvar on PC2 defines PC1DriveD as a networked drive letter.

    Same sharing concept needed if use USB with fname and attach to laptop.

    My .bat code worked flawlessly using %PC1DriveD%\fname.xlsm

    Now, using .vbs, this works:


    Please Login or Register  to view this content.
    I've actually spent weeks unsuccessfully trying to resolve this puzzle

    THANKS!
    Last edited by Sometimes; 08-31-2014 at 10:48 AM. Reason: Code entry guidelines ... fixed properly

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: How to enter %PC1driveD% into .vbs? System environment variable PC1DriveD defined as

    Hi Sometimes,

    The following may help you resolve your problem:
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Registered User
    Join Date
    08-30-2014
    Location
    Lake Worth, Florida
    MS-Off Ver
    Office 2010
    Posts
    2

    Re: How to enter %PC1driveD% into .vbs? System environment variable PC1DriveD defined as

    Lewis, thank you so much for the quick response.

    I had tried various drafts of GetEnvironmentVariableValue,
    and I learned about all kinds of possible error combinations
    on my part!

    I must be daft, but here's what I entered, and I got
    "Expected end of statement" for " Dim sDriveLetter As String"


    Exact code entered is
    ~~~~~~~~~~~~~~~~~~~~~

    Please Login or Register  to view this content.
    Last edited by Sometimes; 08-31-2014 at 10:50 AM. Reason: Corectly following CODE instructions! Sorry!

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: How to enter %PC1driveD% into .vbs? System environment variable PC1DriveD defined as

    I have to apologize, because I gave the right answer to the wrong question. I thought you wanted to read the environment variable in Excel VBA.

    Your question seems to be a VBS question. The following thread may help you read Environment variables in VBS: http://ss64.com/vb/env.html

    The Forum Rules require you to add CODE TAGS when you post code, and require no answers until the CODE TAGS are in place. See http://www.excelforum.com/forum-rule...rum-rules.html

    Lewis

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. open textfile from path defined by environment variable
    By proepert in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-14-2010, 11:25 PM
  2. Access system-environment variables
    By Perry in forum Excel General
    Replies: 3
    Last Post: 03-31-2006, 07:25 AM
  3. [SOLVED] Can you set a Window's Environment variable in VB
    By Ken Soenen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-12-2006, 02:25 PM
  4. [SOLVED] Environment Variable
    By Andibevan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-03-2005, 11:05 AM
  5. Using an Array in Environment Variable
    By Jack Gillis in forum Excel General
    Replies: 6
    Last Post: 06-14-2005, 03:05 PM

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