Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Saving files with variable filenames

Posted on 2001-06-26
2
Medium Priority
?
126 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 180 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

721 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