Hi Friends,
I Want to Write Macro Code in LibreOffice_Calc Macro in BASIC. I My Macro in between I want to Access Folder Path and get the Files From " C " Drive. Under Drive “C”, there is Documents Folder there and In Documents Folder , there are some Sub_Folders are there… and I want to access One Of the Folder “\testing_Folder”.
- Condition is
============
There are Different PCs are there and Each PC have Two Users Sharing Same PC.
Different PC have Different User Name and Each PC have Two Different User Name
But, All The PCs have Same Folder Path …\Documents\Files and Folders\testing_Folder Under
C Drive in Windows 10 Os.
Only Difference is UserName .
I want to Write Macro In LibreOffice Calc, How to get or Equal Function or Method Environ(“UserProfile”) to get the User Profile in Windows 10.
Like VBA have that one to Applicable For All the Users To Run the Macro Code and Will work for that macro in all Users.
For Easy Understanding below Two Macro Code give same Result.
But, 1st Code Will Work Only One PC and also Only One User Name “svthi”
2nd Code Will Work All The PC and All The Users.
Sample Code …To Understand My Point : Hard Code
Sub CreatingFolder_UsingVariable_ToStorePath()
Dim fso As Scripting.FileSystemObject
Dim NewFolderPath As String
Set fso = New Scripting.FileSystemObject
NewFolderPath = "C:\Users\svthi\Documents\Files and Folders\testing_Folder"
If Not fso.FolderExists(NewFolderPath) Then
fso.CreateFolder NewFolderPath
End If
Set fso = Nothing
End Sub
Sample Code : Dedecting User Profile
Sub Dedecting_UserProfile()
Dim fso As Scripting.FileSystemObject
Dim NewFolderPath As String
Set fso = New Scripting.FileSystemObject
NewFolder = Environ("UserProfile") & "\Documents\Files and Folders\testing_Folder
If Not fso.FolderExists(NewFolderPath) Then
fso.CreateFolder NewFolderPath
End If
Set fso = Nothing
End Sub
Please, Help Me