What Drive is the Boot Drive? VBA Function

Chances are, during your programming work, you will need to know what the boot drive is on the computer your routine is currently running on. An old trick from the DOS days is to check the value of the COMSPEC environment variable. You can use the function below to return the path to the system files folder location containing the Shell or Command Interpreter. This same folder is the one typically used by Windows to install ActiveX libraries and controls. You can use this function to programmatically register a control or DLL.

And the best news of all is that this is really easy to do within VBA. Tadalafil Online is also available to its customers with great offers and discounts on generic viagra pills services and the likes. It is levitra cheapest price the major constituent that makes possible for a man to get an erection. It is incredible the money and time many elite and “weekend-warrior” cyclists devote to retrofitting racing bikes to conform to their bodies rather than first restoring function to tadalafil 5mg buy purchased here the most critical piece of racing equipment: the body of the rider.When muscle imbalances, faulty movement patterns, and joint fixations distort the bony framework of the body, the cyclist is led on a never-ending journey searching for. What we have learned from neuroscience over the last ten years, in 65% erections improved with the male HRT treatment alone to sildenafil canada pharmacy amerikabulteni.com the point where intercourse was satisfactory. Getting the value of any environment variable can be done using the built in .Environ$ function. Try the following:

Function ReturnOSPath() As String
‘This function assumes that the “Comspec”
‘variable File path is located on the boot drive
Dim strKRNL As String
strKRNL = VBA.Environ$(“ComSpec”)
On Error GoTo Err_Handler
ReturnOSPath = Mid$(strKRNL, 1, (VBA.Len(strKRNL) – 7))
Exit Function
Err_Handler:
ReturnOSPath = vbNull
End Function

Public Sub testospath()
MsgBox ReturnOSPath
End Sub

To use these, fire up the VBA editor within AutoCAD or any other VBA enabled application. Cut and paste the above code into the editor. Now call the “testospath” procedure to see how it works.

Leave a Reply