Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 12-18-2020, 06:54 PM
macropod's Avatar
macropod macropod is online now I need an application to file and access files. Windows 10 I need an application to file and access files. Office 2010
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If you just want to create a file list by folder, try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim StrFolder As String
' Browse for the starting folder
StrFolder = GetTopFolder
If StrFolder = "" Then Exit Sub
StrFolder = StrFolder & "\*.doc"
If UBound(Split(CreateObject("wscript.shell").Exec("Cmd /c Dir """ & StrFolder & """ /B/S").StdOut.ReadAll, vbCrLf)) > 0 Then
  ActiveDocument.Range.Text = CreateObject("wscript.shell").Exec("Cmd /c Dir """ & StrFolder & """ /B/S").StdOut.ReadAll
End If
Application.ScreenUpdating = True
End Sub

Function GetTopFolder() As String
Dim oFolder As Object
GetTopFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetTopFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
As coded, the above macro finds all Word documents in the chosen folder and its subfolders. For other file types, simply change the '.doc' reference (e.g. '.xls' for all Excel workbooks, '.pdf' for all PDFs).

For PC macro installation & usage instructions, see: Installing Macros

PS: Please update your user profile; I seriously doubt you're running Office 2007 on Windows XP.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Word Error: This file is in use by another application or user conky Word 4 02-26-2019 09:21 AM
I need an application to file and access files. Inserting pictures in a word document launched from another application Fritesmodern Word VBA 2 11-13-2017 02:21 PM
Opening a MS .dot file through ASP.Net application eljapo4 Word 0 09-14-2012 01:11 AM
Application not found error when trying to open .pdf files. Dave Outlook 2 12-15-2005 01:01 PM
I need an application to file and access files. access runtime application will not install markjean Office 1 12-06-2005 02:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft