Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 03-04-2024, 01:46 AM
gmaxey gmaxey is offline Macro to produce a list of all the unique words in a doc Windows 10 Macro to produce a list of all the unique words in a doc Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

ladracer,


"A" for effort. Thank you. While many think we are a free code writing service, our (or at least most of us) objective is to help you learn VBA. Your error message has told you one place you went wrong.


You declared strFolder as a string, and you set it's value to a string. A string variable is not a collection object. Instead of typing in the folder path, you can use the application folder picker:


Code:
  Dim oDlg as FileDialong

  Set oDlg = Application.FileDialog(msoFileDialogFolderPicker)
  If oDlg.Show <> -1 Then Exit Sub
  strFolder = oDlg.SelectedItems(1) & Application.PathSeparator

Again that is just going to return a string value e.g., "C:\My Files\My Batch Folder"


Now you need to iterate through and open each of .doc? files in the folder defined by that string. Look up and see what you find out about the Dir() function. There is your clue.


There will be other gotchas. You will need a row for each file in your folder. A "bevy" may not be enough. Instead of a "bevy" why not just one? Then in your code, as you iterate over each file, add a row. Also in your current code, you are always going to overwrite your data in row 2. You need to index that row number with each file processed.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to produce a list of all the unique words in a doc Macro to Find & Highlight Words from List DRD992 Word VBA 15 06-17-2023 05:06 AM
Macro to produce a list of all the unique words in a doc Sorting does not produce an alphabetical list. alanterrill Word 7 11-22-2022 12:31 PM
Macro to produce a list of all the unique words in a doc Macro to highlight a list of words bakerkr Word VBA 4 10-19-2017 02:23 PM
Macro to produce a list of all the unique words in a doc Create list of unique words trainingclc Excel Programming 3 09-29-2015 06:43 AM
Easiest Way to Produce a Report/List of Tagged Text from Multiple Word Files bxchk Word 5 04-29-2014 03:23 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:42 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