Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-17-2016, 05:40 PM
feenyman99 feenyman99 is offline Delete Text from Insertion Point to Found Text Windows 10 Delete Text from Insertion Point to Found Text Office 2013
Novice
Delete Text from Insertion Point to Found Text
 
Join Date: Apr 2016
Posts: 1
feenyman99 is on a distinguished road
Default Delete Text from Insertion Point to Found Text

Hi. Rookie here...

I have a LARGE text document that is actually the result of executing a DOS "dir /s" command and outputting it to a text file.

This file contains the following pattern repeated MANY times...
Directory of <directory name>
... <list of files>...
<# of files> File(s) <# of bytes> bytes
I want to create a Macro - or VBA code - that deletes the list of files, for EACH of the above blocks, and leaves me with the following...
Directory of <directory name> <# of bytes> bytes


Directory of <directory name> <# of bytes> bytes
...
Directory of <directory name> <# of bytes> bytes

This way I have a list of just the directory names and their sizes.

I imagine the following steps in my Macro:
1) Go to the next occurrence of "Directory of"
2) Go to the End of line
3) Delete from current location to the next occurrence of "File(s)"
4) Loop back to Step 1
I have tried recording a Macro to do this, but I get stuck at Step 3 above.

Can I do this with a Macro? If not, can someone post a VBA snippet that will do the job, if it's not too complicated?

If I should move this post to the VBA part of this forum, I'm happy to do so, but I was hoping I could get away with recording a Macro.

Thx,
feenyman99
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Random insertion of letters into typed text BK42 Office 2 12-10-2015 07:40 AM
Delete Text from Insertion Point to Found Text Insertion point not working pmahoney14 Word 1 05-24-2012 04:17 PM
Delete Text from Insertion Point to Found Text automating insertion of some text obrienaj Word 3 10-17-2011 11:50 AM
Delete Text from Insertion Point to Found Text wildly flashing insertion point with spinning wheel joannetk Word 4 03-10-2011 04:26 AM
Automatic insertion of blank pages or alternate text Diopippo Word 0 07-06-2010 12:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:29 AM.


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