VBA - How to search for folders - vba

I have some problems to write a VBA Script (for Outlook) which is searching for folders on a specific drive. The User can give a Harddrive letter ("C", "D",..) and the keyword for the folder (with wildcards) to search for.
Now it searches the drive for folders with the same name. If it found a folder with the same name, it should add the path to a Listbox, and search for more folders with the same name. I have no glue how to do this, I hope you can help me out.
Thank you so much!

You are looking for the Dir()-Function:
https://support.office.com/en-us/article/Dir-Function-1a1a4275-f92f-4ae4-8b87-41e4513bba2e?ui=en-US&rs=en-US&ad=US
The linked page contains a sample for looping over all subdirs of a given directory right at the end of it.

Related

Directory.GetDirectories on %USERPROFILE%\My Documents

I'm creating a UserControl for my program which will mimic the OpenFileDialog.
When I navigate to a Directory I am using
System.IO.Directory.GetDirectories(Path)
and
System.IO.Directory.GetFiles(Path)
to obtain the contents of the Directory.
When I navigate to %USERPROFILE% (In my case it is C:\Users*UserName*) and there is a hidden My Documents folder as well as a Documents folder.
When you navigate to the My Documents folder it takes you to the Documents folder, but it appears in the list from
System.IO.Directory.GetDirectories(Path)
My question is, is there a way, in code, to find where the My Documents folder is pointing to?
I know that I can find where the My Documents folder is by using
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
but I need to find the actual path each directory will save to in case it's different than it's actual address.
I'd be open to alternatives if it isn't possible.
Thanks

How can I only document a subfolder with GhostDoc?

I am trying to build a HelpFile in GhostDoc. It only gives me the option to document entire Projects. I only want to document a sub folder within a project. How can I do this?
I see no options to select a subfolder. If I right click on a project, no options come up. Does anyone know how to only document a subfolder?
While GhostDoc doesn't directly support the help docs for a folder, there is a workaround you should try.
You can add a tag on top of the namespace in all of the source files under that folder similar to
<tags>MyFolderDocs</tags
And then list MyFolderDocs in the "Tagged with" filter of the Help Configuration window on your screenshot.
I hope this helps.

How to get all files from a folder in sharepoint?

I am working on share point application. I want to get all files from a sub folder which is in a library.Library name is "Record Library". Inside this library folder name is "PROCUREMENT". Inside this folder i have one more folder name is "PURCHASING". In this folder i have file. I want to get all those file names. How can i get?
Please help me.
https://sharepoint.stackexchange.com/questions/19847/sharepoint-2010-how-to-get-all-items-in-a-folder-contained-in-a-list
This might help. People will not write the code for you. You need to attempt what you are asking.

How do I get rid of Word VBA project junk?

When I look at Word VBA on my work computer I have what looks like junk projects. On another PC I have only the normal and currently open documents? Is there a way I can clear this?
These are either hidden documents belonging to addins you have installed, or they're documents that have ended up in your Word startup folder.
Under file..options..addins, check in "Active Application Add-ins" that you don't have anything you didn't want or know about.
Under file..options..advanced..general..file locations, note down the folder for "Startup". Look in that in Explorer and make sure those TMP files aren't in there (you may have to turn on hidden files).
Chris

WORD 2003 - Adding Hyperlinks to other files....can I use currentpath in the hyperlink

I have a document that is an overview document within a folder, there are numerous related documents in a folder that is also in the folder that contains the overview document.
I would like to reference these documents throughout the overview document and allow those to be selected and viewed by clicking.
so i was going to use a hyperlink....but if this folder gets distributed then the hyperlink URL is instantly no good.
So in access I could use a MyPath = currentpath & "\SubFolder.... " idea.
Can I use the same kind of idea here with a hyperlink? How?
I don't seem to be able to add buttons to word documents like with Access and Excel?
Thanks for the advice!
Make the hyperlink relative to the document, this way when it's distributes, the references are kept.