Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-03-2018, 07:27 PM
raywood raywood is offline Divide Text Doc into Multiple Parts at .pa Delimiter Windows 10 Divide Text Doc into Multiple Parts at .pa Delimiter Office 2010 64bit
Novice
Divide Text Doc into Multiple Parts at .pa Delimiter
 
Join Date: Sep 2018
Posts: 10
raywood is on a distinguished road
Default

OK. To try each of these macros in Word 2010 (which, sorry, I didn't specify previously), I opened one of these *.txt docs and pasted its contents into an empty Word doc. Then I ran these macros, with the following results:



(1) Re: the SplitDocument macro (macropod):

"Run-time error '4605': This method or property is not available because no text is selected."

Debug button highlights the ".Copy" line (With DocSrc > With .Range > With Rng).

I guess there must be a Select command that I could insert somewhere before that?

(2) Re: the SplitDoc macro (gmayor):

It asked me for a filename. I thought it was offering to save the pasted text as a Word doc, in whole or in part. I offered Doc001. It said, "Run-time error '5152': This is not a valid file name." So then I figured it was asking for the name of an input file. I closed the opened Word doc, ran the macro again, and specified the input .txt file. But then it said, "Run-time error '4248': This command is not available because no document is open." Debug highlighted "Set oDoc = ActiveDocument."

I tried again with an open but empty Word doc. It offered the Save As dialog. I entered Doc001.docx. It repeated the 5152 error. This time, Debug highlighted "oDoc.SaveAs2 strDocName."

For both of these macros:

Once I figure this out, I'll probably comment the macro to clarify the proper opening steps for a complete noob, so I'll be able to use the macro in the future without stumbling around like this.

Thank you, both of you, for going to the trouble of working up that code. I have a hard time learning coding unless I put in a lot of time. I did that for batch, back in the day, and also for WordPerfect scripts, which made great sense to me. But for some reason I've had a learning block when it comes to VBA. It always seems like I'd have to devote several months to it, and I can't.
Reply With Quote
Reply

Tags
macro, page break, split



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to divide a landscape page into 2 parts rtcary Word 1 01-17-2018 12:07 AM
One long string of text with ; as the delimiter Laurie B. Excel 1 02-28-2015 03:02 AM
Divide Text Doc into Multiple Parts at .pa Delimiter Split file using variable delimiter kramer74 Word VBA 7 09-01-2014 12:12 AM
How do I edit text in Quick Parts? TommyVincent Word 4 07-30-2014 01:51 PM
divide page into 4 parts aclark17 Word 4 01-17-2012 09:04 AM

Other Forums: Access Forums

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