Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Word Macro


Hi I'm new to this forum so not sure if i'm posting in the right place.

I wanna create a Word Macro in the VB editor in Word so that when a user opens a Word document in read only they are not able to edit the document at all, only view it.

Any suggestions?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Word Macro Insert File/ Append Table Macro Issue.
Hello,

I was wondering if someone could help me with this problem...

When I use the following code to insert a table (from an external file), the table that is inserted does not append to the table in first document (which is what I want it to do)...

Sub Macro1()

Selection.Collapse Direction:=wdCollapseEnd
Selection.InsertFile FileName:="m:cat.DOC", Link:=True

End Sub

Would anyone know how I can make the contents of this file append to the table in the first document?

Thanks so much in advance,

Anne

Word Macro Editor Opens When I Misspell A Macro Name
I'm using Word 2000, and pressing Alt+F8 to access macros - just text strings - and here's the trouble:

I'm trying to make it possible for everyone here to use Word macros from the server. I've put a file out there called Macros.dot and it works great. Every machine in the building can see it and use it. Trouble is, if a user misspells a macro name the macro editor opens by default. It doesn't realize the user has misspelled something and thinks the user wants to write a new macro under the "new" name. User can click the X to close the editor, of course, but has now created a blank macro with a name very similar to a real macro. This will drive people (especially the less tech savvy) nuts, and clog up the file Macros.dot with garbage.

Is there a way to disable the macro editor from opening if an incorrect (nonexistent) macro name is typed? A check box somewhere, perhaps? I've tried but can't seem to find it, if it's there.

Thanks

Openning Excel And Running Macro From Word - Macro
Ok - I have a DB which I export to Excel, I then run a macro to "Groom The Data". I then run word and run a Macro (MailMerge to print labels) which retrieves data from the excel spreadsheet groomed above. Everything is working fine, despite my novice knowledge of VB, but I would like to do this in a single click.

I use a command line shortcut to Launch word and automatically have it run the macro, but I still have to Launch Excel and manually run its macro first.

I did not find a command line switch to make excel launch and run a macro. Is there any way I can Lauch Word have its Macro link to excel, then launch and run the excel macros before performing the macro I have set up in word (mailmerge)

In Other Words I have working macros in Word and Excel, I want the Word Macro to force the Excel macro to run before completing the rest of its duties.

Thanks
WW

Word 200 Vba Macro Help - Enable Track Changes In A Macro. Thanks
I was able to find a macro which takes an already mail merged document, and saves each each document as a separate file. The document's filename is taken from the already merged document. The script works. It's in red. See below.

The problem is I need to enable the track changes option.I recorded the following macro. It's in blue.
With ActiveDocument
.TrackRevisions = True
.PrintRevisions = True
.ShowRevisions = True
End With
End Sub

I tried to incorporate this code(blue) into the code (red) below. I added it between ActiveDocument.Sections.First.Range.Cut and Documents.Add but it didn't work.

ActiveDocument.Sections.First.Range.Cut
ActiveDocument.TrackRevisions = True
ActiveDocument.PrintRevisions = True
ActiveDocument.ShowRevisions = True
Documents.Add

It turned on track changes but it didn't create each new document. What am I doing wrong?


Desperately Seeking help!!

Script works perfectly.
Sub SplitMergeLetter()
' splitter Macro
' Macro created 16-08-98 by Doug Robbins to save each letter created by a
' mailmerge as a separate file.
'
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
Application.ScreenUpdating = False
Selection.HomeKey Unit:=wdStory
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
sName = Selection
'set path below
sPath = "C:MERGELETTERS"
Docname = sPath & sName
ActiveDocument.Sections.First.Range.Cut

Documents.Add
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With
ActiveDocument.SaveAs FileName:=Docname, _
FileFormat:=wdFormatDocument
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
End Sub

Word VBA / Macro Problem With Print &amp; Browser (Word 2000)
I am trying to use a macro inside the AutoOpen() event of a Word doc so that when the Word doc is opened inside IE, it will print the Word doc then close both the Word doc and the IE window. For some reason, VBA loses its reference to the doc object and IE Application object after the PrintOut line is executed. I have tried things like:
 Sub AutoOpen()
    MyWord.Visible = False
    MyWord.ActiveDocument.PrintOut
    MyWord.ActiveDocument.Close False
End Sub
or:
Sub AutoOpen()
  With ActiveDocument
     .PrintOut Background:=False
     .Close savechanges:=False
     .Parent.Quit
  End With
End Sub
or:
Sub AutoOpen()
    Dim MyWord As Object
    Set MyWord = GetObject(, "Word.Application")
    Dim IE As Object
    Dim IEDoc As Object
    Set IE = GetObject(, "InternetExplorer.Application")
    Set IEDoc = MyWord.ActiveDocument
    IEDoc.PrintOut
    IEDoc.Close
    IE.Quit
End Sub

But whatever I try, the Word doc prints, then throws a 4605 error about the method or property not being available because the document is in another app. Any ideas?

Thanks,
Chris

MS Word Macro Help
Hello everyone,

All I need is the VB code at the bottom rewritten so that it will strip the red paragraph out of the following example document and place it in a text file (e:illing.txt):


Quote:




Here is the example document:

John Doe
JohnDoe@email.com
123-4567
Febuary 8, 2005

Jane Doe
12 Evergreen Rd.
Calgary, AB
S4S 5K9

Dear Jane,

RE: Document example
Mark: 46547
Country: Canada
Serial: 345Abb7
__________________________________

%%%Febuary 8, 2005,”345ABB7”,” TDLR”,Opposition,”preparing correspondence to Jane Doe regarding trademark renewal deadline approaching on March 17, 2005, seeking instructions regarding same”,”46547”,””,””

We note that there is approximately one month remaining within which to effect a timely renewal of the above captioned trademark registration. Should we not file the necessary renewal documents in advance of the March 17, 2005 deadline,


Yours very truly,

FURMAN & KALLIO



John Doe

JD







Code:
Sub StripBillingInfo()
On Error GoTo errorhandler
'set up variables
Dim SectionNumber As Integer
Dim RangeToSpike As Range
Dim AccumulatedText As String
'loop through sections
For SectionNumber = 1 To ActiveDocument.Sections.Count
'mark the first paragraph of the section, less the paragraph mark
Set RangeToSpike = _
ActiveDocument.Sections(SectionNumber).Range.Paragraphs.First.Range
RangeToSpike.MoveEnd wdCharacter, -1
If RangeToSpike.Start = RangeToSpike.End Then GoTo GetNextSection
If Mid(RangeToSpike.Text, 1, 3) <> "%%%" Then GoTo GetNextSection
'add the first paragraph to the spike, then delete it
RangeToSpike.MoveStart wdCharacter, 3
AccumulatedText = AccumulatedText & RangeToSpike.Text & vbCr
ActiveDocument.Sections(SectionNumber).Range.Paragraphs.First.Range.Delete
GetNextSection:
Next SectionNumber
'create a new document and dump the spike into it
Documents.Open FileName:="e:illing.txt", ConfirmConversions:=False, Format:=wdOpenFormatText
Selection.EndKey wdStory
If Selection.Paragraphs.First.Range.Characters.Count > 1 Then
Selection.InsertParagraph
Selection.EndKey wdStory
End If
Selection.TypeText AccumulatedText
ActiveDocument.Close wdSaveChanges
errorhandler:
End Sub
Thanks, your help is much appreciated!

Macro Word
Imotep,

J'ai un document word d'un nombre certain de pages avec sur chaque début de page un commentaire contenant soit VC soit VS.
J'aimerais créer 2 boutons dans ma barre d'outils:
·Un qui permette de selectionner et copier les pages qui contiennent le commentaire VO dans un nouveau document nommé Version S
·et un autre bouton qui permette de selectionner et copier les pages qui contiennent le commentaire Vs dans un nouveau document nommé Version C.

Pourrais-je avoir le code VBA de cet algorythme s'il vous plait:

Debut
Parcourir Doc tant que fin doc != vrai
Si commentaire Page = VS
Alors Selection Page
Copie Seletion
Ouvre New Doc = "Version S"
Coller Selection dans "Version S"
Fin Si
Imprimer "Version S"
Fin

Merci beaucoup d'avance
Oli

Word Macro
Hello everyone, Does anyone have any ideas on how to do a find and replace in a form field on a protected word Document? Everything that I have tried has given me an error. Pretty much the error is saying that command is not available. any ideas are welcomed. thanks

Macro For Word
Hi,
Just wondering if somebody know how to create a macro in word that will set the "Print To File" property in the print box to be false/unchecked. Because I have this macro on my machine, but every time I try to run this macro, the checkbox for the "Print To File" it's always getting checked up. Anyway here's my code:

Sub acrobat()



Dim name As String
oldprint = ActivePrinter
ActivePrinter = "Acrobat Distiller"
name = WordBasic.GetDocumentVar$("NAME")
ActiveDocument.PrintOut Background:=False, OutputFileName:="c: empin" & name & ".pdf", PrintToFile:=False:
ActivePrinter = oldprint

End Sub


Any suggestions are greatly appreciated.

Word Macro
I need some assistance for a word macro that does this:

When I want to save the document (Alt-S), I want my save as directory to default to a particular path. ("C:Docs"), but I do not want to use Tools>Options to set the directory. Naturally, don' t want nor need the default word save prompt to appear.

Thanks for help.

S

Macro In MS Word?
Hello There!

I wanted to ask if it is possible to make a macro similar to that in excel which will highlight same numerical values across the document automatically. It would be a gift from above to be able to make it highlight values in predefined ranges in different colours on its own - like highlight values between 120 and 140 in red and values between 390 and 467 in green.

Thank you very much !!!

Any thoughts are appreciated!

Dima

Run A Macro In Word
Dear all,
I have to run 2 macros in winword with invisible mode.Currently I am using the following code.Some body help to run two macro automatically one by one.That is run the first one and run the second one.


VB Code:
Dim myword As Object    Set myword = CreateObject("Word.Application")    myword.Documents.Open (G_Working_Folder & "" & G_File_Name & ".doc")'    myword.AddIns.Add "C:ToolEditing.dot", Install:=True'    myword.AddIns.Add "C:ToolConversion.dot", Install:=True'    myword.AddIns.Add "C:ToolConversion.dot", Install:=True    myword.AddIns.Add G_Tool_Folder & "Editing.dot", Install:=True    myword.AddIns.Add G_Tool_Folder & "Conversion.dot", Install:=False    myword.AddIns.Add G_Tool_Folder & "Conversion.dot", Install:=False'  


Thanks in advance.

Word Macro
I have a word macro that gets user info from a form and puts it in the document which works fine. The problem is when I open a new document (doc2) and (doc1) is still open. As soon as I open the userform the focus switches back to (doc1). Any ideas.

MS Word VB Macro
I am building a Macro for Word, so I need to know how to go to a specific line postion and write text. There are soooo many objects/properties/functions I get lost everytime I try.

Help With Word Macro's
I need help make a control box w/ a assigned Macro to it send the document to a specified address. The control box is in Word .
Also if possible I do not want the user to know it is being emailed back to us.
I can make the code work in Excel

ActiveDocument.SendMail Recipients:="user@info.com"

but can't make it work in Word !! Any help would be appreciated

MS Word- Macro
I have a macro created in MS Word. I want to use it in VB . Is it possible to do ............

Word Macro
Hi

Is it possible to programmatically write a macro in the document_Close Event of an existing word document ?


just a little example would help

thanks guys

Word Macro (again...)
Hi,
I would like to know if there is a way/method to know if a Word document containe any Macro ??? Can i Disabled the macro within that document???

Regards

Word Macro
Guys sorry I know this is day one stuff but you know what they say an answer to a question is only easy if you know the answer!!!

Does anybody know how to upate the value of a field within Word 97 from a Word 97 VB macro.

Thanks

Gibbo

Word Macro
Can anyone help?

Basically, what I need to do is create an ‘instance of’ macro for a template.

I need to create a macro that sits on the toolbar and when executed brings up a window. In that new window I would like to be able to input data. The data will be both free text and combo boxes. I can do all of this fine, but what I am having trouble with is the ‘instance of’ part.

I would like the data to automatically populate a word document. In one document there might only be need to enter 3 sets of data and in another there might he 10, so in effect I would be pressing the macro button 1…n times and I am not sure if I can set up the word document to record data like this??? Can anyone help???

Macro VB Word
Hi folks i really need your help
I'm a a beginner in macro vb word
I want to do a macro that add those information below at the beginning of an opened Word document

Here is the code of the macro I wrote :
Sub Test()
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.TypeText Text:="Country:"
Selection.Font.Size = 12
Selection.Font.Bold = wdToggle
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.TypeParagraph
Selection.TypeParagraph
Selection.InsertBreak Type:=wdSectionBreakContinuous
Selection.TypeText Text:="Juridiction :"
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(1).ProtectedForForms = True
ActiveDocument.Sections(2).ProtectedForForms = True
ActiveDocument.Sections(3).ProtectedForForms = False
ActiveDocument.Sections(4).ProtectedForForms = True
ActiveDocument.Sections(5).ProtectedForForms = True
ActiveDocument.Protect Password:="", NoReset:=False, Type:= _
wdAllowOnlyFormFields
End Sub

I also want to create a field in which I can control the format of what the user typed
For instance, a date field which returns a error if the date format typed by the user is not dd/mm/yyyy
I'd like to know if it's possible to do rhat in word and how to do it

Thanx in advance for your help

Lyne

VBA Macro And MS Word
Hi Guys,

i wrote a VBA macro that does "find and replace" in the word document...i mean when i run the macro, i have this predefined array of acronym words that are to be replaced with the actual definitions...

so macro searches through all the text on the word document and if it finds any acronymn it replaces it with its definition...ok everything works fine...

but i have some word documents that i have textboxes on them...and these textboxes have text in it and my find and replace function ignores the text inside the textbox?? i dont know why?

i feel like textbox is a different layer and its not including the active search area??

any suggestions

-DNG

MS Word + VB Macro
Hello Guys,

Totally new to this stuff...so suggestions, useful links and pointers are appreciated...

first let me try to describe my task...

I have a XML mapping file. This file contains (lets say an abbreviated string and the actual complete string). Ok now...i have to create a macro for the MS word document that fires up this XML(not sure if this is the right way to say)and search the whole word document and replace the abbreviated string with the complete string using the XML file info...

does that make sense...

any sample codes...references will be helpful..let me know if you guys need any more info...

Thanks

-DNG

Word Macro
does anyone know how to make a macro in vb for word 2003 that will take lines of text and put quotes around them?
I would do it my self but I have 800 lines that need this.
Example

Rooster
Sam
Dog
Hen
New York
into
"Rooster"
"Sam"
"Dog"
"Hen"
"New York"
Thank you if you can help

Word Macro To
Does anyone have a macro for word to "clean up" email or internet text with inappropriate carriage returns and unneeded characters?

VBA Macro In Word
Sorry for the repeat post. But I can't believe that an expert out there couldn't solve this one

Original Post
~~~~~~~~
I want to be able to run a macro in Word 2000 that I can call which will unlink the field only if it is of a particular style. This means that the field will be be removed permanently and the actual value is replaced.

The code that I have at the moment is shown below. However, it does not work can anyone give be a reason why? Please note that TestTag is a Character Style it is not a Paragraph style.

I get a runtime error 91 when I hit my Table Of Contents (TOC). In the debugger the fldField.Result is the value of the TOC and fldField.Result.Style is "Nothing".

Sub NewLockAllFields()

Dim fldField As Field
For Each fldField In ActiveDocument.Fields
    If fldField.Result <> "Nothing" Then
        If fldField.Result.Style <> "Nothing" Then
            MsgBox fldField.Result.Style
            ' If fldField.Result.Style = "TestTag" Then
            ' fldField.Unlink
            ' End If
        End If
    End If
Next fldField ' moves to the next field
End Sub

Thanks,
BM

Macro In Word
Hi,

I'm trying to write a macro in a Word document (Testdoc.doc) that will print the file Testdoc.doc to a pdf file. This is the function (in Visual Basic) in the macro that does that:

Public Sub bd2pdf_print(Printer As String, FilePath As String, OutputFile As String)

ActivePrinter = Printer

Application.PrintOut FileName:=FilePath, Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="1", PageType:=wdPrintAllPages, _
Collate:=True, Background:=False, PrintToFile:=True, OutputFileName:=OutputFile, _
Append:=False

End Sub

Public Sub bd2pdf_close()
ActiveDocument.Close wdDoNotSaveChanges
End Sub

The parameters "Printer, FilePath, OutputFile" are submitted by a Visual Basic program that I have.
So in that program, I open the word document and then use the command: docapp.Run "bd2pdf_close" (where docapp is Word application) to run the macro. I actually manage to generate a pdf file, but there is something wrong with it. So I wonder if maybe this is correct what I do?
Grateful for help!

Can You Use A MS Word Macro In VB?
Hi,

I have made a macro in MS Word - which uses AutoShapes. Is it possible to get this macro into VB and activate it by the click of a command button in VB?

Mark

Word Macro
Hi ,
Whenever I open a macro it defaults to read only thus disabling me to change the code in the macro how can i Permanently disable the read only property

Iouri looking for ur Excellent advice

Word Macro And VB
Hi ,
I am trying to use a Word Macro with VB, I run the application and I get the message "Project or Library not found" on only one machine on all other machine the macro runs fine, I have a similar macro in word infact this macro has been inherited from the original Macro, the original macro runs fine only the inherited macro gives the error,
Any help and clues would be highly appreciated, I have tried looking for missing Dll , tried reinstalling MSoffice but no use

Run A Macro At Startup Of Word
Hi everybody,

does anyone know how to run a macro when word starts?
The macro is in a global template, which is stored in the startup path of word.

The backround: On installation of the global.dot, I write a version string to an ini-file. On another ini-file the version string of the actual version of the global.dot is stored. If the both version strings are not equal, I want a messagebox to appear, telling the user about the update.

Everything works fine so far, but I had no success in running a macro at the startup of word.

Every idea is welcome. Thanks.

_____
viebas

Word Macro Recovery
I was stupid and overwrote my normal.dot with another copy, killing most of my macros needed for a few programs. A friend told me that Word's Macro9.dot would have macros for Macro recovery, because he said a copy of them was saved elsewhere on the machine, but it's not in Macro9. Is there a program, macro, or just a location of a macro backup so I might be able to recover my Macros? I have Word 2000 on this machine, and sadly, my norton protected files doesn't contain an unchanged copy. Thanks.

Problems About Word Macro...
Hi!
i am usuing Word Macro to paste some graphs but i have problems abut resizing them.. while pasting i want to chage sizes.. How can i do such a thing?
i did something wiht word and record it with macro but there is a problem in the "Selection.InlineShapes(1).Line.Visible = msoFalseprivate sub" line...

Sub Macro5()
Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Solid
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalseprivate sub
Selection.InlineShapes(1).LockAspectRatio = msoFalse
Selection.InlineShapes(1).Height = 194.15
Selection.InlineShapes(1).Width = 325.7
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
Selection.InlineShapes(1).Left = 0#
Selection.InlineShapes(1).Top = 0#
End Sub

can anyone help me?

Word Macro Help: Within The Document
I have a macro (word 2000, vb 6-ish) that looks at every line for duplicate lines and inevitably ends up removing some. I have the for loop set to BuiltInDocumentProperties(wdPropertyLines) but naturally, if I end up removing, say, half of the lines from a 5000 line document, it's gonna keep going for awhile.
I would like to find an IF statement to compare to, if it reaches the end of the file.
I know there's DO WHILE NOT EOF(1), but this only works for when something ELSE opens the file, doesn't it? Since it's a macro, I'm already in the file. Is there a different way to accomplish this? What's the property I should be looking for to confirm the cursor has hit the end of the document?

Word/macro/input Box
hi need help on making an input box in Word 97, then after the person puts their name in it, it puts the date & their name in the header. then save the document as 'project'. this should all be done as a macro. i already have done the pop-up of the input box asking for the name. but can't get further than that. Help asap, because i need it before at noon.

XL Macro Won't Execte From Word
I have the following VBA code in Word:

Dim xls As Object
Dim wrk As Excel.workbook
Dim xlfilename As String
xlfilename = "C:QtestExcel.xls"
Set xls = CreateObject("Excel.Application")
xls.Visible = True
Set wrk = xls.workbooks.Open(xlfilename)
Application.Run "xlfilename!AggregateFileDocs"

when I run the routine I get "Unable to run the specified macro." Am I referencing the macro incorrectly? I know that the macro works in Excel. I tried

Application.Run "QtestExcel!AggregateFileDocs"

that didn't work either. Thoughts?

Thanks,
Ron

Start A First VB Macro Under Word
Lol

I am new here and I have any questions .Newbie question sorry and a short problem

1/Where have I to begin to do visual basic macros under Word ?
2/I search the visual basic functions of Word where are they ?
For example I search the visual basic function wich replace the text in word ?
Where are the explications wich show the function ‘replace text’ and explain their arguments .
3/I search too any good links about visual basic under word or excel only .
Why ?Because I search a macro wich has probably already be done.At all events I will search on this forum , I have seen a lot of links wich seems to be interressant .

4/Here is the type of macro that I want to do under word

Considering the occurences of this text .I want to remove all the occurrence of U EIP ?

U EIo
456
U EIo
64+4
U EIo
64+648
U EIo
64654
U EIo
4654
U EIo

Before doing a a macro , I have try the special “replace text”(inside the menu edit) ;remplaces the text U EIP with nothing and add a jump of line by using the symbol ^l of word and I have got this

456


64+4


64+648


64654


4654

I have obtained the half of the result .I want to obtain the contrary of a jump of line that is a return char

Finaly I want a compact text like this

456
64+4
64+648
64654
4654

Was somebody be able to help me ?

HELP - Word Macro With Pic Format
What code will find all images in a Active.Document (word file) and change the brightness and contrast? I am using the following code...

Dim imgNum As Integer
imgNum = ActiveDocument.InlineShapes.Count 'find total # of images in doc

MsgBox "Document contains " & imgNum & " image(s)."

For n = 1 To imgNum
With ActiveDocument.InlineShapes(n).PictureFormat
.Brightness = 0.52
.Contrast = 0.48
.ColorType = msoPictureGrayscale

End With
Next n

I have a doc with over 40 images and the count is coming up as 3 and not altering all images? What am I missing...these images are pasted screen shots! Thanks in advance!

Open MS Word &amp; Run Macro
HELP - This is exactly what I want to do however I am getting a compile error that user defined type not defined for "dim WordApp as Word.Application"

Why would I be getting this? Thanks!

Quote:Originally Posted by InsertFunnyName
Code:
Function RunWordMacro()
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open _
("C:Wordtest.doc")
WordApp.Visible = True
WordApp.Run "Macro1"

' Uncomment the next line of code to print the document.
' WordDoc.PrintOut Background:=False

' Uncomment the next line of code to save the modified document.
' WordDoc.Save

WordApp.Quit SaveChanges:=wdDoNotSaveChanges
Set WordApp = Nothing
End Function

Word Macro Question
Hi,

I'm new to writing macros and would greatly appreciate any assistance you can provide.

Here is the situation -
I already recorded a Macro that writes following text to the document.

Title:[
Type:[
Subject:[
]
Content:[


Now, users will be able to insert the text above automatically by clicking the button on the Toolbar. No problem upto here.

Once they insert this text, they will also add some information below the text. They will do this manually.

Once this is done, they should be able to click on a Macro button (or a Submit button), which saves this file automatically to a server at a central location.

Does anyone have any experience or ideas on how one should go about writing a routine or macro that saves a particular file over a network?

Thanks
Anant

Simple Word XP Macro (ha!)
I thought writing this macro would offer little challenge, yet I can't get it to work. I simply need to locate all instances of a word in a document (say "and"), highlight them and change the font color to red. Yet any time I record a macro to do this, I only get the location of the insertion pointer to turn red, all other instances of the word remain black. I chose "main document" in the options for the global find command. The macro steps seem simple enough:
1. set insertion point to the beginning of the document,
2. use find command to find all instances of "and" in the document and highlight them,
3. close the find dialog
4. click on the icon to change font color to red.

All this works as I record the macro, but when I run the macro, nothing happens except at the insertion point.

Any help much appreciated, thanks,

philip ganderton

Password And VBA Macro Word
I forgot my password of a macro and I want to open that Maccro. How can I open this macro otherwise? How can I find my password?
Cees Streefkerk
The Netherlands

Word / Excel Macro
Can anyone help me? I have written a Word 2000 macro which opens up an Excel spreadsheet. This is also being used by Office 97 users. I put in the appropriate references but what I am finding is that although I can run it without a problem Office 97 users get a 'Cannot find project or library' error message.

When I check the References box it becomes clear that although all other references have automatically changed from version 9.0 to version 8.0 this does not happen with the Excel one (it just comes up saying MISSING) despite the user having Excel 8.0 in their list.

Is there something else I need to do to counteract this?

Open MS Word &amp; Run Macro
Anyone know how to open a MS Word doc from a VB6 Application and automatically run a global macro already saved within MS Word? I'm familiar with this syntax but I'm not sure if running a macro is a command line parameter I can use:

Shell "C:Program FilesMicrosoft OfficeOfficeWinWord.exe C:SomeFile.doc", vbNormalFocus

Run Macro When Word Doc Opens
Can anyone please show me how to do any of the following? I'm using Office 97:

1. Run a Word macro from Excel.

2. Run a macro when Word starts up.

2. Run a macro when a Word document opens.

Thanx to all.

Word &amp; Excel Macro
Dear All,

How do I write a Macro that will link tasks in Excel & Word? I want to copy a table from Excel and paste in a word document and then copy a different table and paste it in to a different Word document.

I do not think this can be simply 'recorded' using the VBA record macro function so how do I begin to write it?

Thank you for your time,

internationally

Word Macro Running Help!
I have a macro that runs everytime a document based on the normal.dot templat is opened (using private sub document_open() ) that sets the margins to 0.5" and paper layout to landscape. I need it to only run on files that begin with a specific name (QC_A1601015_(4numbers here unique to each file).txt eg: QC_A1601015_1234.txt) so how can i put in an 'if filename = QC_A1601015_*.txt then' style command so it checks what the filename is then does the formatting if its right??

Thanks for any possible solutions!

Word Macro Renumbering
HI

I have a Word document that is generated from a FoxPro database.
The document has various numbered section headings in the format of number decimal number (ie 2.10). Some of these sections do not contain any content so the word "None" is displayed underneath the section heading. When the macro is ran, it should look at the document and find all the occurrences of the word "None" and then delete them and the entire section and then renumber subsequent sections.

For example, if the document contains:
2.09
None

2.10
Sample content

The macro should delete the entire 2.09 section and renumber section 2.10 to be 2.09.

Hope this is not too confusing. Any help would be greatly appreciated.

Thanks
Trent

Word Macro For Format Changes
I have a word macro that converts Word 2000 formatting, such as italics or bold, into tagging. So italics would become <ital>italics</ital>.

However, there have been some instances where someone will manually put in the italics tagging around an italicized word, which results in double tagging. What I need to do is be able to look around the italicized word to find if there are existing tags.

This is the macro coding so far:

Code:
Public Function ItalicsToText(strOpenTag As String, strCloseTag As String) As Boolean

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
With .Font
Selection.Find.Font.Italic = True
Selection.Find.Font.bold = False
End With
Do While .Execute(FindText:="", Format:=True) = True
With .Font
Selection.Font.Italic = False
End With

If Selection.Characters(1).Text = " " Then Selection.MoveStart Unit:=wdCharacter, count:=1

Selection.InsertBefore Text:=strOpenTag

If Selection.End = Selection.Paragraphs(Selection.Paragraphs.count).Range.End Then Selection.MoveEnd Unit:=wdCharacter, count:=-1

Selection.InsertAfter Text:=strCloseTag

Selection.MoveRight Unit:=wdCharacter, count:=1
Loop
End With

ItalicsToText = True

End Function
How do I modify this to look around and then NOT output the tagging should tagging already exist?

Thanks,
Mike

Copyright © 2005-08 www.BigResource.com, All rights reserved