954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

open folder

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

ramlisarip
Newbie Poster
7 posts since Oct 2007
Reputation Points: 10
Solved Threads: 1
 
ShellExecute hWnd, "explore", "C:\whatever", _
    vbNullString, vbNullString, SW_SHOWNORMAL


I got it from http://vb-helper.com/howto_shellexecute.html

Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
 

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

ramlisarip
Newbie Poster
7 posts since Oct 2007
Reputation Points: 10
Solved Threads: 1
 

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,

Asad__
Newbie Poster
8 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

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

hawisme000
Junior Poster
102 posts since Jul 2007
Reputation Points: 10
Solved Threads: 2
 

i was answer your question in you newer thread.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

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

Asad__
Newbie Poster
8 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

thanx Jx_man for ur attention and time ...

Asad__
Newbie Poster
8 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

no prob Asad_ :) glad to help

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

hawisme000
Junior Poster
102 posts since Jul 2007
Reputation Points: 10
Solved Threads: 2
 

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

jamesdeamon18
Newbie Poster
1 post since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

>:continue_

continue
Newbie Poster
1 post since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

[QUOTE=hawisme000;557940]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

mhine.jhuniane
Newbie Poster
1 post since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You