Solved

renameming a folder

Posted on 2002-07-05
9
160 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 50

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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

773 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