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

x
?
Solved

How to delete a file, with path set in Environment Variables, using Visual Basic 6 VB6?

Posted on 2011-02-26
2
Medium Priority
?
487 Views
Last Modified: 2012-05-11
I have a system variable in Environment Variables set to:
Variable:
VAPATH
Value:
z:\test\vbapps\

As an example I am trying to delete a file z:\test\vbapps\test.text
I know my Environment Variable is fine because I can open it in RUN using:
%vapath%\test.txt

This doesn't work....
Private Sub Command1_Click()
Kill ("%vapath%\test.txt")
End Sub

I am using Visual Basic 6(VB6) and WinXP pro
0
Comment
Question by:daneburr
[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 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 1000 total points
ID: 34989678
Kill Environ("VAPATH") & "test.txt"

Wayne
0
 

Author Closing Comment

by:daneburr
ID: 34989686
Answered REAL FAST!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Suggested Courses

722 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