Link to home
Start Free TrialLog in
Avatar of choccarlm
choccarlm

asked on

Saving files with variable filenames

How do I save a file, but using a variable in my program as the file name. At the moment I use
open "c:\windows\desktop\somefilename" for output as #1

What I want is

open "C:\windows\desktop\(text1.text)" for output as #1.

How would I do this?
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcbeth
mcbeth

Const pzPath = "C:\"
Dim pzName As String
pzName = pzPath & "text1.txt"
Open pzName For Output As #1#
Print #1, "Hallo"
Close #1