Monday, May 24, 2010

What is the generic symbol for the root directory in visual basic?

how can I indicate the root direcotry in a file path description when writing a visual basic macro?

What is the generic symbol for the root directory in visual basic?
You can try using the tilda ~ to indicate the current path as





~/mySub/myProgram.exe


this would indicate to use the subdirectory from the current application path





Or you can use the application object and extract what path info you need. This code extracts the root of the current dirve based upon the application path string





Private Sub cmdDir_Click()


Dim appPath, appRoot As String


Dim ay() As String





appPath = Me.Application.Path


ay = Split(appPath, ":")


appRoot = ay(0) %26amp; ":\"





End Sub
Reply:you should use a function wich shows the root directory


get help from MSDN


No comments:

Post a Comment