Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Keeping Macros intact
I think that your time would be better spent trying to develop a macro for
which you have a purpose rather than being bored to death in some Comm College Class. If you take this approach, and get stuck, post to the microsoft.public.word.vba.general newsgroup. -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. "Jay" wrote in message ... Graham, Thanks for the reply. As I started reading the first link you sent, I kept up until about halfway down and then crumbled. You're correct, learning VB will be a steep curve. I'm going to need to crawl before I walk. I have a very crude understanding of programming so I think the best place to start may be with a simple class at a Comm College to get me started. Once I really understand the basics then the curve flattens out... at least in my case it does. Thank you again for your assistance. "Graham Mayor" wrote: Thats something of a leap from recording a macro and the learning curve is going to be quite steep. A good place to start would be http://gregmaxey.mvps.org/VBA_Basics.htm. Then for the batch macro code you would need the following which will open and close each document in a selected folder. If you don't know how to use listings - see http://www.gmayor.com/installing_macro.htm Sub BatchProcess() Dim strFilename As String Dim strPath As String Dim oDoc As Document Dim fDialog As FileDialog Set fDialog = Application.FileDialog(msoFileDialogFolderPicker) With fDialog .Title = "Select folder and click OK" .AllowMultiSelect = False .InitialView = msoFileDialogViewList If .Show -1 Then MsgBox "Cancelled By User", , _ "List Folder Contents" Exit Sub End If strPath = fDialog.SelectedItems.Item(1) If Right(strPath, 1) "\" _ Then strPath = strPath + "\" End With If Documents.Count 0 Then Documents.Close SaveChanges:=wdPromptToSaveChanges End If If Left(strPath, 1) = Chr(34) Then strPath = Mid(strPath, 2, Len(strPath) - 2) End If strFilename = Dir$(strPath & "*.doc") While Len(strFilename) 0 Set oDoc = Documents.Open(strPath & strFilename) ' 'Do what you want with oDoc ' oDoc.Close SaveChanges:=wdSaveChanges strFilename = Dir$() Wend End Sub As to what to do with the documents (oDoc) when they are opened rather, this depends on what *exactly* you want to change. When you have worked it out for one document, post your further questions in the Word vba forum. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Jay" wrote in message ... Thanks for the help Doug. Although my question wasn't answered, you've sparked enough curiousity now that I'm going to go learn VBA. I was using the macro recorder, which is a nice tool, but I can see now just how powerful VBA is. My redefined situation is this. My company has merged with another and all the quality documents (over 6000) need their header replaced with a new table and logo. Also we're changing a signature page by adding another column, from 2 to 3, for people to print their name. This has to happen on all the documents so I'm looking to build a macro that takes some of the repetitiveness out of this. My guess is that I'll need a template with this new frame, logo and table to source for this to happen. I'm going to muddle through the mvp site to see if I can solve this but any help is appreciated. "Doug Robbins - Word MVP" wrote: See the article "Getting To Grips With VBA Basics In 15 Minutes" at: http://www.word.mvps.org/FAQs/Macros...csIn15Mins.htm -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. "Jay" wrote in message ... I'm trying to create 2 different macros in word 03'. I think I'm doing everything correctly, but when I go to save the 2nd macro, the 1st one I recorded starts to mimic the new macro. I'm not sure if it's a naming problem, a placement problem or what. Can anyone help? . |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Moving a table within a document and keeping track changes intact | Tables | |||
How do I copy from Publisher to Word keeping everything intact? | Microsoft Word Help | |||
How to keep rule length intact when in Forms (and in a table)? | Tables | |||
How do I properly save a file to keep links intact in XP? | Microsoft Word Help | |||
Keep Formatting Intact with Send To > Mail Recipient | Microsoft Word Help |