Solved

Saving files with variable filenames

Posted on 2001-06-26
2
121 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 50

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

770 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