Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Environment variables in Visual Basic (Vb5E, W7/64)

10 views
Skip to first unread message

Helge

unread,
Jun 25, 2012, 11:10:18 AM6/25/12
to
Hallo NG!
I need to open PathA = "%USERPROFILE%\Documents\paper\pp.csv"
Open PathA for Output as #FiNu
But it does not work that easy. Any ideas? Thanks!
Vy 73! Helge
--
Helge, DJ1WM

ralph

unread,
Jun 25, 2012, 11:43:46 AM6/25/12
to
The "%" delimiters are for use with shells. At the command line, in
batch files, Windows Shells (Explorer) etc.

In VB use the Environ() function without the delimiters.
Dim sRoot As String : sRoot = Environ("userprofile")
PathA = PathA = sRoot & "\Documents\paper\pp.csv"

-ralph

Auric__

unread,
Jun 25, 2012, 2:17:56 PM6/25/12
to
ralph wrote:

> On Mon, 25 Jun 2012 17:10:18 +0200, Helge <w...@nurfuerspam.de> wrote:
>
>>Hallo NG!
>>I need to open PathA = "%USERPROFILE%\Documents\paper\pp.csv"
>> Open PathA for Output as #FiNu
>>But it does not work that easy. Any ideas? Thanks!
>
> The "%" delimiters are for use with shells. At the command line, in
> batch files, Windows Shells (Explorer) etc.
>
> In VB use the Environ() function without the delimiters.
> Dim sRoot As String : sRoot = Environ("userprofile")
> PathA = PathA = sRoot & "\Documents\paper\pp.csv"

No real need for the extra string:

PathA = Environ("userprofile") & "\Documents\paper\pp.csv"

--
Step right up. I've got plenty of death for everybody.

Helge

unread,
Jun 26, 2012, 3:59:47 AM6/26/12
to
Thanks! That's it.
--
Helge, DJ1WM
0 new messages