Solved

renameming a folder

Posted on 2002-07-05
9
158 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
9 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
I am new to application dev.

what does app.path relate to.

what are all the different paths
0
 
LVL 28

Expert Comment

by:vinnyd79
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:yongyih
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks for the answer
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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…

772 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