🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.basic.visual.misc
Article #492

Re: passing a variable into a file path

#492
From: Karl Thomas
Date: Fri, 04 Jun 1999 00:00
32 lines
1279 bytes
Eelco Mulder wrote in message <7j5oo7$imc$1@zonnetje.NL.net>...
>Workbooks.OpenText FileName:="I:\ncms\squares\" + i + ".dat"
>
>is so wrong because VB uses a '&' to glue things, you have to use


No the problem isn't using the + for concatentation.  Even though "&" is the
preferred method the + will work.


>
>Workbooks.OpenText FileName:="I:\ncms\squares\" & i & ".dat"



Have you tried your solution?  It will give you a type mismatch error.

Try:

Workbooks.OpenText FileName:="I:\ncms\squares\" + cstr(i) + ".dat"





>
>Eelco Mulder
>EMulder at Ravelin.NL
>
>
>
Technical Details
Message-ID: <7j8if1$4a$1@nntp9.atl.mindspring.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <375646F9.B69F03FE@mluri.sari.ac.uk> <7j5oo7$imc$1@zonnetje.NL.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1053fc,127dc2f266373ae
X-Google-Attributes: gid1053fc,public
X-Google-Thread: 110e3b,127dc2f266373ae
X-Google-Attributes: gid110e3b,public
From: "Karl Thomas" <kathomas@nox.nyx.net>
Subject: Re: passing a variable into a file path
Date: 1999/06/04
Message-ID: <7j8if1$4a$1@nntp9.atl.mindspring.net>
X-Deja-AN: 485652667
References: <375646F9.B69F03FE@mluri.sari.ac.uk> <7j5oo7$imc$1@zonnetje.NL.net>
X-Server-Date: 4 Jun 1999 12:57:05 GMT
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: MindSpring Enterprises
Newsgroups: comp.lang.basic.visual.misc,es.comp.lenguajes.visual-basic