简体   繁体   中英

Open specific Folder in excel using vb.net in VisualStudio

I have to update an add-in that not written by me and i have to add a button that opens the specific path. I have no idea about this add-in. I could just add the button...

    Private Sub RBOpenFolder_OnClick(sender As Object, control As IRibbonControl, pressed As Boolean) Handles RBOpenFolder.OnClick

    End Sub

....\\AppData\\Local\\AppName I have to access this address but the path changes on each pc has this add-in.

So in my computer C:\\Users\\Taylan\\AppData\\Local\\AppName

Regards

If I am understanding this correctly, you are trying to access the user's local AppData folder via your application.

To achieve this, simply use the Environment.GetFolderPath and specify the local application data folder:

Dim FolderNameAs String

FolderName = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

In your case, this would return:

C:\Users\Taylan\AppData\Local\

You will then need to append the remainder of your path to this, so add AppName :

FolderName = System.IO.Path.Combine(FolderName, "AppName")

The FolderName variable will then contain:

C:\Users\Taylan\AppData\Local\AppName

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM