Solved

Saving files with variable filenames

Posted on 2001-06-26
2
119 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
Comment Utility
Hi,

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

0
 
LVL 1

Expert Comment

by:mcbeth
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

762 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

11 Experts available now in Live!

Get 1:1 Help Now