hello...how to open folder using vb??using shell function?

Recommended Answers

All 11 Replies

there are some errors. it says shellexecute hWnd and SW_SHOWNORMAL are not declared.

hi, am brand new to VB. i have the same problem. i want to open a folder, say; My Computer on clicking a command button on VB GUI. i have something like this:

Private Sub Command1_Click()
ShellExecute hWnd, "open", "C:\apache", _
vbNullString, vbNullString, SW_SHOWNORMAL
End Sub
but it gives compilation error. "Sub or Function not defined"
can somebody help me out.
Regards,

Private Sub Command1_Click()
Shell "explorer.exe C:", vbMaximizedFocus
End Sub

If you want to open some other folder instead of "C:" just delete "C:" and write the path to the folder you want to open.

Hope it helps


here other ways to open msoffice for additional information just edit the path

Dim Word
Set Word = CreateObject("Word.Application")
Set doc = Word.documents.Add(App.path & "\DOCUCAI.doc")
Word.Visible = True


----------------

'Dim dTaskID As Double, path As String, file As String
path = "C:\WINDOWS\notepad.exe"
file = App.path & "\USERMANUAL.txt"
dTaskID = Shell(path + " " + file, vbNormalFocus)

---------------


Set power = CreateObject("PowerPoint.application")
power.Visible = True
Set doc = power.Presentations.Open(App.path & "\Ppoint.ppt")
power.activePresentation.slideShowSettings.Run
'pptObject.ActivePresentation.SlideShowSettings.Run
End Sub

all off those code will open msoffice files on the same folder where you save the put ur project..

good day

give me a feed back if it solve ur prob

i was answer your question in you newer thread.

thanx alot Hawisme000, it worked :)
i hope u will help me in future queries too ...

thanx Jx_man for ur attention and time ...

no prob Asad_ :) glad to help

im just returning the favor for this site~~~~~~~~~(singing) :D

say thats awesome! but how to open a folder on your own folder like no C: Drive? like opening folder sound? Please Help me!

>:continue_

Private Sub Command1_Click()
Shell "explorer.exe C:", vbMaximizedFocus
End Sub

thanks for the code...im actually looking for this for the submission of my thesis thru cd

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.