Solved

Saving files with variable filenames

Posted on 2001-06-26
2
120 Views
Last Modified: 2010-05-02
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?
0
Comment
Question by:choccarlm
2 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 45 total points
ID: 6227016
Hi,

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

0
 
LVL 1

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA loop through headers using value 3 56
VB6 add a minute to the date time value 8 61
Passing a Text Box name to a Sub 6 71
Problem to With line 4 39
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now