Insert {XE "test"}{TC "Test" \l 1}
Automation a word report from Access. At run time, I want to be able to
insert 2 field type to a company name. One type for a TOC and a second for an
index. I'am using a table for an uniform layout. How can I simply insert
those field right after the company name in the cell ? Maybe I started all
wrong ?
Do until rst.eof
Set Tbl = Wrd.ActiveDocument.Tables.Add(Wrd.Selection.Range, 8, 2)
with Tbl
.Cell(1, 1).Range.Text = "Company name :"
.Cell(1, 1).Range.Style = wdStyleStrong
.Cell(1, 2).Range.Text = rst!CompName
'insert {XE "test"}{TC "Test" \l 1} after the company name...
end with
wrd.selection.InsertBreak Type:=wdSectionBreakNextPage
rst.movenext
loop Tag: Locating Misspelled words Tag: 110632
Find page number for each word in document
Hi All,
I have a Word document for which I'm trying to create an index. I've
just started this code, but the idea is to parse through each word and
dump out the word and the page number to a CSV file that I can
manipulate later on (or dump it to a dictionary object or array or
something so I can manipulated it in code). The end result being the
100 least used words in the document should make a halfway decent
index.
My problem is that I can't figure out how to get the the page number
to show up correctly using the following code:
Function CreateIndex()
Dim fso, NewsFile
Set fso =3D CreateObject("Scripting.FileSystemObject")
Set File =3D fso.CreateTextFile("c:\book\sampleindex.csv", True)
Set objDictionary =3D CreateObject("Scripting.Dictionary")
Set colWords =3D Application.ActiveDocument.Words
For Each strWord In colWords
strWord =3D LCase(strWord)
strLetter =3D Left(strWord, 1)
If Asc(strLetter) < 97 Or Asc(strLetter) > 122 Then
Else
ActiveWindow.ScrollIntoView Selection.Range, True
intPage =3D Selection.Range.Information(wdActiveEndPageNumber)
MsgBox (strWord & "," & intPage)
File.WriteLine strWord & "," & intPage
End If
Next
File.Close
End Function
I'm pretty new to VBA for Word, but I'm not terrible at VBS, so I can
sometimes keep up with you =FCber scripters out there.
The result of this script is a CSV file that has each word in the
document, and the number "1", because wdActiveEndPageNumber always
returns a "1". I tried to add the "ActiveWindow.ScrollIntoView" line
to scroll to the page, but I have a feeling I'm missing something for
that to work.
So, any help you guys can offer would be much appreciated.
Thanks!
Gabe Tag: Locating Misspelled words Tag: 110625
ThisDocument Question
I have documents that are created from a template but once they get up into
our system get delinked from the template. What I have done is when the
document is created it copies all the forms and macros into each document. My
question is how do I copy the following macros into ThisDocument?
Option Explicit
'reserve memory for an application variable
Private WithEvents wdApp As Word.Application
Private Sub Document_New()
'assign Word to the application variable
If wdApp Is Nothing Then
Set wdApp = ThisDocument.Application
End If
End Sub
Private Sub Document_Open()
'assign Word to the application variable
If wdApp Is Nothing Then
Set wdApp = ThisDocument.Application
End If
End Sub
Private Sub wdApp_WindowSelectionChange(ByVal Sel As Selection)
'quit if active doc isn't attached to this template
If ActiveDocument.AttachedTemplate <> ThisDocument Then Exit Sub
'get out of the header if we're in it
Select Case Sel.StoryType
Case wdFirstPageHeaderStory 'wdPrimaryHeaderStory
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
frmTable.Show
Exit Sub
Case Else
If Sel.Range.InRange(ActiveDocument.Bookmarks("bktable").Range) Then
ActiveDocument.Bookmarks("bkbeforetbl").Select
frmTable.Show
End If
If Sel.Range.InRange(ActiveDocument.Bookmarks("bkProTitle").Range) Then
ActiveDocument.Bookmarks("bkbeforetbl").Select
frmType.Show
End If
End Select
End Sub Tag: Locating Misspelled words Tag: 110623
Inserting a checkbox using VBA
I have a macro in Outlook that will create a word document. I want to
insert a checkbox control.
objWord.ActiveDocument.Bookmarks("Required").Select
objWord.Selection.TypeText CStr(names)
basically it select a bookmark, then type in some names. Instead of
plain text I want it to be a checkbox with the caption = names.
I tried this:
objWord.Selection.InlineShapes.AddOLEControl
ClassType:="Forms.CheckBox.1"
However the checkbox just won't show up. Tag: Locating Misspelled words Tag: 110622
How to replace OLE in Word?
How to see source object in Word? /OLE, please vanish!/
1) z.B. How to get an underlined blue text and to click on it and to send
E-mail INSTEAD OF having this in Word doc: {HYPERLINK "mailto:oat@defgo.ru"
}?
2)z.B. How to see real picture instead of reading this: {EMBED MSPhotoEd.3} ?
Thank you! Tag: Locating Misspelled words Tag: 110620
GotoBottom
Using Word 2003, I have set up a Protected/Unprotected Form Form(set)...The
file contains 5 different forms used by the engineering department. All of
the forms, with the exception of the first must be able to replicate
themselves. The forms are constructed using tables and section breaks as
required. At the bottom of each of the forms in the set is a paragraph mark
(set to 1.5 points). I am using the small routine (below) as part of the
macro to get to the bottom of each page, add a 'page break', and then insert
a specific table stored as an autotext entry to create another page in the
series. When I record the macro (gotobottom, insert break-page, autotext-add
table) the new page is there (bam!). All of the macros for this document are
stored in a toolbar for the engineers to use. When I run the macro from the
toolbar - the new page is all messed up. The page break is being added in
the table above, pushing the balance of the table to the next page along with
the addition of the autotext table and a space is added at the top of the
original table which also pushes the table further down..... I tried creating
a 'dummy' scenario in a blank document and when I initiate the gotobottom by
itself, it jumps to the cell marker (outside the table) at the last cell,
last row and not to a paragraph mark placed below the table, as I believe it
should. If I place two paragraph marks below the table, then the cursor does
jump to the first paragraph mark below the table.... can someone please
explain what may be happening and how I can correct to get the desired
results??? my thanks and best regards, Lenny
Sub GotoPgBottom()
Dim rTmp As Range
Set rTmp = Selection.Bookmarks("\page").Range
rTmp.End = rTmp.End - 1
rTmp.Collapse direction:=wdCollapseEnd
rTmp.Select
End Sub Tag: Locating Misspelled words Tag: 110619
Perform readability statistics
Hello,
I know that I can get the readability statistics when I execute a grammar
check, but is there a way to simply execute the readability statistics
without running a complete grammar check. Just run it on the text as is? i
am specifically trying to get the Flesch score for a document at the click of
a button without any interaction on the behalf of the user.
Thank you,
QB Tag: Locating Misspelled words Tag: 110615
split repeating table
in my form i have repeating table, bind with webservice,
receive data from database, data in more than 5000 rows.
now i want to split this repeating table in pages, 100 rows per page
is this possible without coding???
I use page break in repeating table, but it can't work.
thanks
--
Message posted via http://www.officekb.com Tag: Locating Misspelled words Tag: 110613
Adding user to word document?
Hi,
Once I have logged onto my Windows XP machine in work, I was wondering
if it was possible to add my user to a word document as soon as it is
opened. i.e. I log on as DSmith, could DSmith be inserted into a field
in a word document upon open? and if so, how?
Appreciate any advice on this. Tag: Locating Misspelled words Tag: 110607
selecting specific text within a cell
Office 2003 Pro.
I am creating tables in Word and then adding text to these tables and
formatting.
Qu.1
------
This example shows 2 bits of text going into one cell. What I want to
do is then make "Title text" bold, and I end up always setting the
whole cell bold. How should I do this without using an extra row for
my title ?
Set rng = objWord.ActiveDocument.Tables(intTable).Cell(1, 1).Range
rng.Text = "Title text"
rng.Text = "Some more text"
rng.InsertAfter (strUnit)
Qu.2
------
My table has multiple rows and combination of x1 column or x2 columns:
Is it best to create all x1 column and use cell.slit or create all x2
columns and use cell.merge,... or it doesnt matter ? Tag: Locating Misspelled words Tag: 110606
Link to Outlook Contacts
I'm wondering if this is possible I'd like to link to an Outlook contact. I
know how to grab the information both via MAPI and the address book.
However, I'd like to create an updatable link to a specific contact item.
Any ideas?
Thanks. Tag: Locating Misspelled words Tag: 110604
Word 2003 macro to re-place original clipboard contents
I have a WORD 2003 macro that uses the clipboard to do various things.
When the macro finishes, the clipboard contains a bit of the stuff the
macro put into it. I would like the macro to re-place whatc had
originally been in the clipboard. What I would like to have happen is this
****SEMI PSEUDO CODE****************
Sub DummyMacro()
' at beginning of macro copy
' clipboard material into variable
Dim myOriginalClipboardVariable as string
myOriginalClipboardVariable:= clipboard_contents
'
'Here macro does a bunch of stuff. A
'At the end of the macro, just before exiting
'clear the clipboard
clipboard:= ""
' then place stuff that was originally in the clipboard back
clipboard := myOriginalClipboardVariable
End Sub
******END SEMI PSEUDO CODE*********
I realize that this will not work as I have written it, but that's
because I am not yet familiar enough with VBA basics.
Would anyone mind giving me a hand here?
Regards,
Alan Stancliff Tag: Locating Misspelled words Tag: 110601
hyperlinks in protected doc
I have a table which is protected because it has formfields.
I want to put in hyperlinks to a Help file at various points.
The only way I've found to do this is to put in unprotected
sections where I have the links.
This leads to other problems.
Any better ideas? Tag: Locating Misspelled words Tag: 110599
Referencing Bookmarks and Fields
Hello
I was wondering if there is a way of representing the same bookmark (or
field) in multiple places in a word document. I've designed a userform that
requires input from the user and places data in appropriate placeholders in a
document. For instance, suppose I want a particular phone number (let's say
180 -555-5000) to automatically be inserted into 7 different locations in a
document from data extracted from a userform. Must I create 7 different
bookmarks/fields in each place I want to see the number represented? I know
Wordperfect 9 is capable of inserting the same bookmark with the same data in
multiple places so that you avoid creating a new bookmark for the same data.
Any thoughts? Thanks. Tag: Locating Misspelled words Tag: 110593
VBA code to merge 2 tables
I have an authoring software that automatically creates a Word
document from text stored in a database. The software allows for VBA
code to be run while the Word document is being created.
Here's my problem:
In one instance, a table is being broken up in 2 pieces with 3
paragraph marks separating the 2 tables. I need the macro to remove
the paragraph marks, so that the 2 tables get merged. I have tried
researching this in here, but no luck.
Any help is appreciated. Tag: Locating Misspelled words Tag: 110588
Built-in properties
Hi, I've just found out there is a built-in properties thingy, and I found
out that there seem to be 30 of them. However, I had to write some code to
list them out (below, in case you need it) and I still don't have
definitions of what these properties actually are. It's fairly obvious what
most of them are, but what is 'format' for example?
The inbuilt help never seems to just give a simple listing of these
different options. Why would that be?
Here's the code to list them, btw:
Sub GetBuiltInDocumentProperties()
On Error Resume Next
mytext = ""
For i = 1 To 255
mytext = mytext & i & " " &
ActiveDocument.BuiltInDocumentProperties(i).Name & ":- " &
ActiveDocument.BuiltInDocumentProperties(i).Value & vbCrLf
Next
MsgBox mytext
End Sub
This lists out properties 1 - 30, but how do I know there isn't a property
number 699 (or 6,000,699) for example? Tag: Locating Misspelled words Tag: 110587
Creating Custom Mailing List
I want to be able to create a database of my customers and be able to run a
program that will print a formatted letter and envelopes to the different
customers without having to manually input names and address, what is the
best program for this scenario.
Thank you Tag: Locating Misspelled words Tag: 110580
Propose save file name
Hi.
I'm developing an applicaiton, that starts the word, opens a document based
on a template and fill some information in it. Then the user can modify this
document.
If the user wants to save it, the file name in the SaveAs-dialog is
"document.doc"
The question is: how can I set the proposed name of document by my
application?
Thanks a lot.
Anatoli Rejditsch. Tag: Locating Misspelled words Tag: 110577
Get DropDown Lists in 2007 out of AddIns
(Is there a new 2007 board that I should be writing to with this question?)
I have written a large program for 2003 (and before). I can create dropdown
lists for various selections I need to make, and position them in the
toolbar without problem. This is the essential code:
Set newlist = mybar.Controls.Add(Type:=msoControlDropdown)
For n = 1 To ubound(filenamed)
newlist.AddItem filenamed(n)
Next
newlist.OnAction = "DoStuff"
THE PROBLEM:
In 2007, the commandbar (list) appears in the AddIns tab. I have created a
new tab (called "My Program") that houses other commands regarding the
program (so I can at least move those command buttons out of the generic
"AddIns" tab). But I cannot figure out how to place the dropdown list into
the "My Program" tab. Any ideas?
Ed (in VA) Tag: Locating Misspelled words Tag: 110574
Search for text box formatted to Layout: In line with text
Hi.
I've managed to set up a macro that hides the content of all text boxes in
my document by searching for each text box and setting the contents' font
colour to white. However, it only seems to find text boxes that haven't been
formatted to 'Layout: In line with text'.
Does anybody know way to search for and edit these text boxes as well as the
others?
Here is the code that I am using:
Sub HideAnswers()
' Find each text box and set it's font colour to white
Dim aShape As Shape
For Each aShape In ActiveDocument.Shapes
If aShape.Type = msoTextBox Then
aShape.Select
Selection.Font.Color = wdColorWhite
End If
Next
End Sub
Any help would be really appreciated.
Cheers,
Dan. Tag: Locating Misspelled words Tag: 110571
embded excel spreadsheet
Hi,
I tried to embed excel spreadsheet into the word template document but when
I try to use macrobutton in this sheet it does not do anything. could
somebody tell me why?
thanks
Peter Tag: Locating Misspelled words Tag: 110570
CALLING EXTERNAL DOCS
Hi.
How could I call external document to open with macro after selecting
macrobutton in userform?
I need to have four slightly different templates of document with
differencies only in number of active substances what will cause to use of
diggerent userforms and different documents.
small difference at the beginnign, big difference at the end.
could somebody help?
Thanks
Peter Tag: Locating Misspelled words Tag: 110569
ActiveDocument - AutoOpen
Good morning,
I am trying to create a macro that will allow me to recall the AutoOpen
function of the current document.
I have been trying the following with no prevail:
From within my Normal.dot file, this one only causes errors.
[code]
Sub Reset_Document()
Application.Run ActiveDocument.ThisModule.ThisProcedure
End Sub
[/code]
and this one does half the job
[code]
Sub Reset_Document()
With ActiveDocument
.Reload
.ResetFormFields
End Sub
[/code]
and this one only errors
[code]
Sub Reset_Document()
With ActiveDocument
.ResetFormFields
AutoOpen()
End Sub
[/code]
Now the middle one causes my fields to be cleared, which is nice; but I have
some Input boxes that appear when the user opens the document and they do not
appear.
So my question is: How do I recall the AutoOpen function of my document from
a Macro stored in another document?
On another note, how do I highlight code? Tag: Locating Misspelled words Tag: 110563
Other groups...
Greetings to all,
Now that I have a 9-5 desk job, I cannot access the groups with he tools I
would like to use. During the last 5 years I was using Outlook Express at
home where I used to work as well. Here at the office I am now stuck with
Lotus Notes. I tried accessing Usenet with Lotus Notes (It does offer
Newsgroup capabilities) and with OE, but I believe the security set up by the
IT people at the company is preventing me from making an NNTP connection. So
I am using the Web Interface.
I am getting accustomed to it. But I noticed that it is called "Word
programming."
Where are the 5 basic VBA groups I am used to
(microsoft.public.word.vba.addins, microsoft.public.word.vba.beginners,
microsoft.public.word.vba.customization, microsoft.public.word.vba.general,
microsoft.public.word.vba.userforms)?
Also, while I was on Google groups, I noticed that there is a group called
"microsoft.public.word.vba". I never saw it with OE.... What is it? Was it
always around but I just never noticed it thinking it was just a prefix, not
an actual group)?
Am I correct in asuming that "Word Programing" is in fact
"microsoft.public.word.vba.general"?
If there is no connection between the Web interface and those 6 groups, how
do people, post to those groups? (Presumebly this means that there is no
connection betwen Word itself and those 6 groups.) Will I have to use Google
to access those groups? Anybody using Google to manage their posts? How is it?
Thanks. Tag: Locating Misspelled words Tag: 110555
pictures and W2007 treatment
After reading Daiya Mitchell's article "Word Doesn't Know What a Page Is," I
wonder if the mailbox treatment that she described (text one one,
headers/footers another, floating graphics on another) is still applicable in
Word 2007? Here's why I ask.
To avoid problems with float over graphics wandering into unwanted places
when reflowing text, I have instead placed images into multi column
borderless tables as in-line. I do this only when I need to simulate wrapped
text. Is this cautionary practice necessary anymore with the new structure of
W2007? I have just gotten the 2007 Office Suite and am not XML literate
enough to know its impact.
Any insights would be appreciated. Tag: Locating Misspelled words Tag: 110553
How to close the template or Document 1
Hi
Someone has very kindly helped with some code which I need to ammend in
order to be complete but I am not sure how to do it.....I have tried many
various possiblities.
First thing that happens when a certain document opens is a form appears
allowing a user to select a template.
This is the code behind one of the buttons on the form.
Private Sub CommandButton1_Click()
Word.Documents.Add Template:="G:\Template\ent_test.dot"
Me.Hide
ThisDocument.Close
Document1.Close
End Sub
This works great and opens a new document based on the template closing the
original document.
This is the code behind the template which fills certain fields with merged
data which works perfectly.
Sub AutoNew()
With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:= _
"C:\ENTMRG.DBF", ConfirmConversions:=False
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute
End With
End Sub
My only problem is, once the template opens and the macro is run, although a
correct document opens, the template or at least a document called Document1
is also open. Ideally, I would like that document to close without saving
changes only leaving the document with the merged data open.
The reason why is it is giving the user to many options for confusion when
closing multiple documents.
I hope you understand what I am asking as it is not easy to explain. Tag: Locating Misspelled words Tag: 110533
Open File on ftp site
Good afternoon --
I want to set up a command button to open a document sitting on our office
ftp site. So, if the file address is ftp://folder/subfolder/document.doc,
can someone help me with a code snippet?
Thanks in advance. Tag: Locating Misspelled words Tag: 110529
Making a check box that will automatically put in check when click
We are making a form that will be filled out on the internet and must have a
check box that will put a check mark into the box when clicked on. The
directions from "help" are not making it happen. The form has been created
and the check boxes added to it, could this be the problem? How to fix?
HELP! Tag: Locating Misspelled words Tag: 110526
Locking Master Document
I need to be able to lock a word master document from VBA. In word from the
outline view when I position the cursor inside the master document and click
the Lock Document icon this works fine but if I record these actions the
macro produced contains the code:
Selection.Range.Subdocuments(1).Locked = Not Selection.Range.Subdocuments( _
1).Locked
If I run this macro I get a message saying the selected member of the
collection does not exist.
Anyone know how to lock a master document from VBA? Tag: Locating Misspelled words Tag: 110523
Displaying Conditional Content in Word 2007
I'm looking for recommendations on creating and managing conditional content
in Word. Examples may be:
1. I have a resume that has slightly different content for different
industries' jobs I'm applying for. For example, in my last job in the
"Experience" section, I may want to put three bullet points with text for my
"manufacturing industry" resume and two of the same bullets of from the first
list and another new bullet point (also hiding one of the bullet points from
the first resume) for my "financial industry" resume. If I want to add a 3rd
industry to apply for, such as the medical industry, maybe I just want to
replace certain words in an existing financial industry bullet, for example,
replacing the word "Sarbanes-Oxley" with "HIPAA".
2. I am creating a course on a subject. The end result will be 3 seperate
documents - Instructor Guide, Participant Guide and Classroom Logistics
Guide. The Instructor Guide will include the Participant Guide and Classroom
Logistics Guide, as well as instructor delivery notes (in seperate blocks of
content, like "Say This", "Common Questions from Participants", "How to Run
this Activity"). The Classroom Logistics Guide will just be one or two sheets
that may need to be saved seperately so it can be sent to another person if
they are arranging part of the classroom logistics.
Rather than perform a huge amount of copy/paste/delete and try to keep all
the data current, I'm looking to just keep all this information in a single
document - any outputted documents will be the result of editing the single
document template.
I've read some about XML and XSLT, but I don't know if they are what I'm
looking for, because it appears that XSLT will reformat the document, when
all I want is content switched out or removed/added based on content type -
all formatting should stay as is. Is this something I can just tag certain
content with an XML tag and then run a VBA routine against to remove that tag
from the view of the rest of the document? The "Memo" and "Resume" XML
samples for Word on MSDN weren't helpful. Bill Coan has a good example I
looked at on wordsite.com, but his is all about formating for HTML (but the
key idea is there as to what I'm looking for).
I've also considered using "hidden text" inside of a Content Control and
then just using VBA to hide all parts I don't need via the Control's tag, but
that's just a binary choice of include/don't include and I need conditional
logic.
Any help in this regard is deeply appreciated - pointers, samples, real
world examples, a smack in the face... :)
DD Tag: Locating Misspelled words Tag: 110514
trust macros in Word 2007
Is there a way I can define Word 2007 .docm files to be trusted when
coworkers download them from our Company intranet and then open them?
A solution that doesn't require the user to allow macros each time would be
greatly appreciated. Tag: Locating Misspelled words Tag: 110512
How to get a user commandbar to always appear
I've found some posts from people who can't get rid of their command bars but
my problem is the opposite.
In Excel to get a custom commandbar to run at startup I just use:
Private Sub Workbook_Open()
CreateTheComandBar
End Sub
It can be in any template and if it's in Personal.xls then it'll appear in
all my workbooks.
How do I do the same in Word ?
Private Sub Document_Open()
CreateTheComandBar
End Sub
...in Normal.dot doesn't work. The same thing in Document_New works for
subsequent new documents but the bar ain't there when I start word.
Running "CreateTheComandBar" from the VBA editor works just fine but if I
close and restart Word it's gone.
Why are Word and Excel *still* so different in their behavior after so many
wonderful years of co-existence ?
--
David M
WinXP - Office2003 (Italian) Tag: Locating Misspelled words Tag: 110500
Reformatting text
I receive a report in Word and need to export to an Access database. The
problem is the record format isn't in a delimited format. Each record in
Word has the following format:
fied1 text (tab) field2 text(paragraph)
field3 text (tab) field4 text(paragraph)
field5(paragraph)
paragraph
number
paragraph
Next Record
I would like to create a macro or something so the format for each record is
something like: text, text, text, text, number so I can save as txt and
import into Access. Tag: Locating Misspelled words Tag: 110496
How to: Block user input temporarily?
Hi,
If I am manipulating text in a word document using e.g. selection
property, I might want to keep the user from inadvertantly typing over
my temporary selection by blocking user input. In Excel I could set
Interactive = false I gather - is there an equivalent setting for
Word?
Sincerely,
Anders Tag: Locating Misspelled words Tag: 110492
Use of Macro in combination with auto text and comment field
Hi,
What I want to do is create a macro button so that I can automatically
insert a comment field with some auto text in it. It works fine if I do it
manually â?? I can insert a comment into the text and then select the comment
field and place auto text into this. However, when I try to do this procedure
using a macro I get Run time error 5941 â??The requested member of the
collection does not existâ?? Any ideas? I am using Word 2007.
Thanks David Tag: Locating Misspelled words Tag: 110478
Avoiding the Find/Replace dialog in Word 2003
This is a question related to Word 2003 and VBA
I posed this question in an earlier thread, but it was needlessly
complicated and wordy. Here's a clearer way of formulating my question,
perhaps. I hope I'm not breaking any good netizen conventions here.
This is the previous thread:
If you use a newsreader:
news://msnews.microsoft.com:119/eonojSFcIHA.1960@TK2MSFTNGP02.phx.gbl
If you use a browser:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.word.vba.general&tid=f3baadfe-daeb-4809-9368-f0d5981d8cac&cat=en_US_eb67b351-9403-4888-a42c-b2b58efec0aa&lang=en&cr=US&sloc=en-us&m=1&p=1
Right now, I have a routine that, in part, finds a medical record number
at the top of a document and creates an autocorrect entry for it. I put
it together with macro record and some hints from this forum. The way it
works is that the cursor jumps to the top of the document, finds the
words "Medical Record Number", selects the medical record number, which
is located just to the right, and assigns it to an autocorrect entry MRN.
I'd like to do that without relying on the dialog box, which causes
things to jump around. Assume my cursor is in section 2 and I want it to
stay that way at the end of the macro's run. How would I do that?
Here is the sample code:
Sub MyDemo()
'
' go to top of section
'
Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst, Count:=1,
Name:=""
'
' find medical record number
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Medical Record Number: "
.Forward = True
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdWord, Count:=1
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
'
'Assign to Autocorrect entry mrn
'
AutoCorrect.Entries.Add Name:="mrn", Value:=Selection.Text
Selection.EndKey Unit:=wdLine
End Sub
Regards,
Alan Tag: Locating Misspelled words Tag: 110474
I need a super duper mail merge macro created. Please help
Is there a way to create a template for a word document to have certain
fields pre-populated with form fields and then create a macro to take the
necessity for a user to have to open Mail Merge wizzard and start locating
the data source etc?
Deeper.....
We run our in house software and we can press a 'Letter' button which
creates a .dbf file which is automatically saved in the root of the users C
drive. If they have created this .dbf file, it means they are going to send
a letter to the person who was on the form they were looking at before
clicking the 'Letter' button.
Now, just assuming that the only fields in the dbf file were
first name
last name
address
I would want the user to open there template document (not saved in the C
drive) which would already have the first name, last name and address form
fields in the correct place of the template.
This is when I would like the user to be able to press a form button or
whatever that will then automatically point the fileds to the corresponding
fields in the .dbf field so that our users do not have to try and use the
Mail Merge wizard. They WILL NOT use the Mail Merge wizard as they are
scared of computers.
I know this may be complex or even impossible, but if it can be done, you
will forever be deemed a hero. If it can't be done, other suggestions are
welcome.
Thanks in advance
Malcolm Tag: Locating Misspelled words Tag: 110473
drag and backspace
When I drag the mouse to select some sentences and press 'backspace' to
delete them, it does not delete. It used to do this but it's not working
anymore. Only with Microsoft Word. Others works fine. Tag: Locating Misspelled words Tag: 110470
2 spaces to 1 space in Word 2003.
I have been using a macro at work to take all double spacing after
periods, colons, etc, out of a document and replace them with double
spaces. This macro works on the entire document.
The document is broken into three sections, as defined by the menu items
INSERT>BREAK>CONTINUOUS. I have been trying to figure out how it can
be made to work this magic on only section 2.
This macro is mostly based on one I found in a Word website, and the
proper credit is given in the comment section.
Here is the macro. Any assistance would be very much appreciated.
Sub SingleSpace()
'
'<alt><ctrl><5>
' Changes 2 spaces after periods and colons
' to 1 space in conformity with our hospital
' guidelines.
' Macro modified by Alan Stancliff, based on macro
' copied from Allen Wyatt's Word Tips
'
http://wordtips.vitalnews.com/Pages/T1497_An_Automatic_Two_Spaces_After_a_Period.html
' ******************************
'
Selection.Find.ClearFormatting
'Selection.Find.ClearFormatting.Section (2)
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\?\!\:]) {1,}"
.Replacement.Text = "\1 "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Application.Run MacroName:="FixFindBox"
End Sub
Regards,
Alan Stancliff Tag: Locating Misspelled words Tag: 110469
Persistent toolbar .... how irritating
This seems so trivial but it isn't to me. I have a Word doc which when
opened, shows the 'Control Toolbox' toolbar as well as a small dialog box
that allows me to exit 'Design Mode'. I don't want these items to appear so I
close the latter and I turn the former off at View/toolbars/Control. I then
save the document.
When I then re-open the doc, the same two items re-appear. Why? It doesn't
happen with other documents.
TIA ... Greg Tag: Locating Misspelled words Tag: 110466
VBA code to delete a page in a Word doc
Hi,
I am using Word 2003. May I ask how to write a VBA code to delete a
certain page in a Word document? Thank you.
Mike Tag: Locating Misspelled words Tag: 110458
Word Count - But not all of them!
Hi,
Is it possible to use the word count feature in Office 2007 (and hopefully
in Word 2003) to count the words in specific pages in a document?
I don't want to include the title page or appendices.
Thank you,
Pete Tag: Locating Misspelled words Tag: 110455
Write text in table within textbox placed in pagefooter
Hi
I have a problem with a table/texbox object placed in pagefooter. Se
the
description and code here:
'-------------------------------------------------------------------------
' WANT: Replace existing text with new text - format it - in the
pagefooter,
' and the text shall be place in a table there is place in a
textbox
' (there are already added a textbox and inside this a table:
' one row and one coloum).
' COMMENT:
' It works fine when the texbox and table are placed on the
page
' PROBLEM:
' It can't find the shape in pagefooter, and I don't know how to
get it.
' (it shall be a shape and not at frame)
'-------------------------------------------------------------------------
Sub ReplaceText_TableTextbox()
Dim txt_adress As Range
With ActiveDocument
Set txt_adress = .Shapes(1).TextFrame.TextRange
txt_adress.Tables(1).Cell(1, 1).Range.Delete
txt_adress.Tables(1).Cell(1, 1).Range = "This is the first line"
txt_adress.Tables(1).Cell(1, 1).Range.InsertParagraphAfter
txt_adress.Tables(1).Cell(1, 1).Range.InsertAfter "This is the
second line"
txt_adress.Tables(1).Cell(1, 1).Range.InsertParagraphAfter
txt_adress.Tables(1).Cell(1, 1).Range.InsertAfter "This is the last
line"
'Line 1: Bold and spaceafter 10
txt_adress.Paragraphs(1).Range.Bold = True
txt_adress.Paragraphs(1).Range.ParagraphFormat.SpaceAfter = 10
'Line 2: Font size 16
txt_adress.Paragraphs(2).Range.Font.Size = 16
End With
End Sub Tag: Locating Misspelled words Tag: 110450
How highlighting all found items with a macro?
Hello. The Dialog Box of "Find and Replace" (Tab "Find") including the
field with the text "Highlight all items found in...". I need to
select all found words with help macro but I not know how I do it. I
wrote code of searching and highlighting next item but not all items:
With Selection.Find
.ClearFormatting
.Text = Selection.Text
.Replacement.ClearFormatting
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.Execute
End With
How highlighting all found items? Thank you very much. Tag: Locating Misspelled words Tag: 110446
Automatically Lock Document
Hi,
Is it possible to automatically lock a document when opening. I have a
document with form fields. When certain users open the document I want the
form fields to be locked so they will only be able to enter text in the form
field. I can't rely on the user to lock the document. I can't save the
document with it locked because other users may need to check the document
out and edit it.
Any suggestions are welcome.
Thanks,
Mickey Tag: Locating Misspelled words Tag: 110438
Creating a Find and Replace Macro in Powerpoint
I'd like to create a Find and Replace Macro in Powerpoint that I can
use each day on a different Powerpoint file.
I'm very inexperienced at VBA. However, I was able to use the macro
recorder in MS Word to record a find and replace macro, which I placed
into its own template document, which covers over a hundred items.
Talk about the timesaver of the century.
I also have to edit Powerpoint documents. My edits include text in
textboxes in the slide as well as note pages.
1. Since Powerpoint doesn't have a macro recorder, could I copy the
text below that is used in MS Word into Powerpoint?
2. How would I save it to be available over time (since I edit
documents everyday)?
I recognize that this question is probably very basic for the talent I
see here, but it saves me considerable time doing edits that a
computer can handle in seconds. Thanks.
Jay
VBA is my friend (VBAimf)
Sub Godtest()
'
' God test Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "god"
.Replacement.Text = "God"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub Tag: Locating Misspelled words Tag: 110433
Replace Title Case Function with Macro?
I use Format > Change Case > Title Case quite frequently. However, it is a
pain to have to change all the short words (e.g., the, a, of) back to lower
case.
There is a macro that takes care of that (shown below). I was wondering if I
should replace Word's Change Case function with this macro. Any downsides to
doing that? I've never written my own macro before and all previous macro
work was "step by step" instructions I followed.
If I replace Word's Change Case function with this macro, can someone pls
let me know how I would go about doing it? If I didn't replace the Word
function, how would I set up using this macro?
Using Word 2003 on standalone PC (XP).
Any insights much appreciated.
Here's the macro:
Intelligent Title Case, taken from Allen Wyatt's Word Tips (on-line):
Sub TitleCase()
Dim lclist As String
Dim wrd As Integer
Dim sTest As String
' list of lowercase words, surrounded by spaces
lclist = " of the by to this is from a "
Selection.Range.Case = wdTitleWord
For wrd = 2 To Selection.Range.Words.Count
sTest = Trim(Selection.Range.Words(wrd))
sTest = " " & LCase(sTest) & " "
If InStr(lclist, sTest) Then
Selection.Range.Words(wrd).Case = wdLowerCase
End If
Next wrd
End Sub Tag: Locating Misspelled words Tag: 110431
In Word 2003, a macro that reads screen size and cursor position
Is it possible for a macro to be written that can tell how many lines
are on the screen and which line the cursor is on when the macro runs?
Optionally, I would like to put these into message boxes.
I'm trying to figure something out.
Regards,
Alan Tag: Locating Misspelled words Tag: 110411
VBA Gerus,
Is there a function to locate misspelled words that were identified by
Word 2003 & 2007? Thanks.
Not really sure what you mean by locate, but the following will select each
mispelled word and display it in a message box
Dim aspe As Range
For Each aspe In ActiveDocument.SpellingErrors
aspe.Select
MsgBox aspe.Text
Next
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
<Charlie Mac> wrote in message
news:jomrr35l5kl0hqom241k31cqlfpsp6cdh8@4ax.com...
> VBA Gerus,
>
> Is there a function to locate misspelled words that were identified by
> Word 2003 & 2007? Thanks.
>
> Charlie from Texas