Open a Folder Depend Textbox Value

SkyGod

New Member
Joined
May 18, 2020
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hello there,
I've a main folder named "main".
I bring the image on userform by textbox1.value.

VBA Code:
Dim obj_fso As Object
Dim myPath As Variant
Dim folderPath As Variant
folderPath = ThisWorkbook.Path & "\main\" & TextBox1.Text & ".jpg"

  Set obj_fso = CreateObject("Scripting.FileSystemObject")
Dim cmd As String
If obj_fso.fileExists(folderPath) = True Then
cmd = "RunDLL32.exe C:\Windows\System32\Shimgvw.dll,ImageView_Fullscreen " & folderPath
Shell cmd, vbMaximizedFocus
Else
MsgBox "No pic!", vbExclamation, "Error"
End If

Well i wanna change the codes a little,
I will make a folder with spesific names in main folder. I will put the pics inside their spesific named folder and i wanna bring the image on userform with tetxbox1.value.
../main/x1
../main/x2
etc
if textbox1.value = x1 then go to main/ x1/ sub folder and chose the first picture or random one. Like this. depends textbox1.value

Thank you for help.
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top