Login | |
|
 |
Word Macro To Modify Files - 4/11/2005 9:15:26 PM
|
|
 |
|
| |
Teignmouth2005
Posts: 4
Score: 0
Joined: 4/11/2005
From:
Status: offline
|
Hi all, I was hoping somebody on here might be able to help me with a query regarding a macro I've been writing for my organisation. The piece of script in question is designed to make formatting modifications to a file which I can successfully do. At presentm, the script (which is copied below) asks the user for the file number/name they wish to modify, they type this in, the file is loaded, changed and saved. However, the aim is to be able to run this script of a batch of maybe a dozen or so files automatically, rather than have to prompt the user each time for the file name. Any suggestions on how to get the script to open all files in a specified location (ie. C:\files\) and make the changes rather than needing to enter the file name. The actual files will differ on a daily basis and have randomly generated file names. Many thanks for any help you can provide. Darren Hermes **** Script as it stands at present in the MS Word macro **** Sub ChangeText() Dim strData as String strData = InputBox("What file number?") Documents.Open FileName:= strDATA & ".txt" Selection.EndKey Unit:=wdLine Selection.MoveLeft Unit:=wdCharacter, Count:=7, Extend:=wdExtend Selection.Cut Selection.HomeKey Unit:=wdLine Selection.MoveDown Unit:=wdLine, Count:=1 Selection.MoveRight Unit:=wdCharacter, Count:=48 Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend Selection.PasteAndFormat (wdPasteDefault) Selection.TypeText Text:=" " Selection.HomeKey Unit:=wdLine ActiveDocument.Save End Sub
|
|
| |
|
|
|
 |
Re: Word Macro To Modify Files - 4/13/2005 10:28:19 AM
|
|
 |
|
| |
Snipah
Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
I have something similar... I do file mods on very different files, only the mods are all the same... What i did is: Create a macro in my Normal.dot...Create an external VBS which calls the desired file(s) and runs the Macro (all from the same VBS, which i only need to fire up: the .vbs) Easy does it...
|
|
| |
|
|
|
|
|