Solved

renameming a folder

Posted on 2002-07-05
9
163 Views
Last Modified: 2011-10-03
I have a installation pakage,I am using the depoyment wizard to create it.
I need to rename the old folder that the application used to install to,the in the dp wizard i will set the path to be the renamed folder.

I have a installation procees that is spawnd when i run my exe. I need to put the renaiming code in there how do i do this
0
Comment
Question by:Vignette
[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
9 Comments
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 100 total points
ID: 7131459
Try:

Dim a As String, b As String

a = app.path & "\a"
b = app.path & "\b"
Name a As b
0
 
LVL 2

Expert Comment

by:yongyih
ID: 7131531
in load method of the first form display on screen, put:

Name app.path as "c:\new Folder"

Hope this can help...
0
 

Author Comment

by:Vignette
ID: 7131534
I am new to application dev.

what does app.path relate to.

what are all the different paths
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:vinnyd79
ID: 7131763
yongyih, how can you name the folder that you are running your app from to something else?I don't think you can because the app is in use.

app.path relates to the directory where your app is being run from.If you are running in VB's IDE then it will be the location of your project file(.vbp) If you are running a compiled .exe then it will be the location of your .exe file.

You can test this out by using a message box in your form load event:
MsgBox = app.path
0
 
LVL 2

Expert Comment

by:yongyih
ID: 7133229
app.path will return the path of your exe file.
if your program in c:\temp, it will return "c:\temp"

to: vinnyd79
  i tried it just now. i create a new project that has a button.  the code in this button is:

  Name App.Path As "c:\temp2"

then i create an exe file for this project and copy it to c:\temp

  then, i run the program in c:\temp folder and click the button.  No error.  Then i go drive C.  The c:\temp  folder is rename to c:\temp2.

  So, i think should be no problem. If this is not what you mean, please explain again, Thank. ^_^
0
 

Author Comment

by:Vignette
ID: 7142940
I have tested the app.path function this is not going to work in my case.

I am using the FileSystemObject to find the folder.

For some reason its not finding the folder my code looks something like this

 Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM FAP GENERATOR\"
MsgBox sFilePath
MsgBox App.Path
 If oFileSystemObject.FileExists(sFilePath) Then
    MsgBox sFilePath
   vbLogEventTypeInformation
  End If


Can anyone help me.
Would this work for windows 98 and 2000 machines
0
 

Author Comment

by:Vignette
ID: 7142976
Sorry My code was wrong

it should read

Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM FAP GENERATOR\"
MsgBox sFilePath
MsgBox App.Path
If oFileSystemObject.FolderExists(sFilePath) Then
  'rename folder

 End If
0
 

Author Comment

by:Vignette
ID: 7143179
Hi I have fixed the prob thanks for all your guys help this is the code i am using.

Will this work on windows 98 machines aswell


Set oFileSystemObject = CreateObject("Scripting.FileSystemObject")
sFilePath = "c:\Program Files\PWM DOCUMENT GENERATOR\"
MsgBox sFilePath



 If oFileSystemObject.FolderExists(sFilePath) Then
   
    Dim a As String
    Dim b As String
   
    a = sFilePath
    b = "c:\Program Files\PWM GENERATOR\"
 
   Name a As b
   
   MsgBox b
  End If
0
 

Author Comment

by:Vignette
ID: 7143180
thanks for the answer
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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 have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

628 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