Building a WOrd Document
I have done all of my VBA programming from Excel. Now I haev a task in Word
and feel like a fish out of water!
Point me in the right direction(s), please.
I have a document which goes on for several pages. Let's call them "Rules
1-30" with each rule a paragraph or two. What I'd like to do is present a
dialog which prompts the user to select which rules/paragraphs to include,
and then present them a Word Document to save and print which has just the
rules they selected.
Of course there is much more involved but this would get me going. Any
links to examples is appreciated. Sites to visit,, etc.
-----
Of course I'd like to be able to prompt for names, dates, accounts first
then insert the selected rules, then some closing info. Tag: How to Reference to the IADs object Tag: 113226
combo box, drop down - dynamic populate
I have an insurance template which auto populates some fields from a
database. One of the fields being populated is a client id. What I would also
like to do get the policies of this client and populate a drop down or combo
box.
I know how to sql the databases but unsure of how to populate the drop-down
or combo box for selection.
Example:
Let's say client abc has 5 different policies with our company (PAP 101, HO
123, CF 345, MC 456, and GL 890).
I would like the drop down or combo box to populate with this info.
Once one is selected then I would populate additional fileds based upon
info of that policy.
Thanks for the help in advance.
Bryan Tag: How to Reference to the IADs object Tag: 113225
word07- auto fill isn't working - type febru and no suggestion.
Using Word 07 - in older programs when you type say, the month, it would pop
up and you could 'auto fill' by hitting enter. This is NOT working for some
reason. I've tried to correct in in Word Options. Could I have changed it
somehow in my Styles settings?
I would like this turned on for ALL Word documents. Please help!
Thank you.
--
Gardengramma Tag: How to Reference to the IADs object Tag: 113223
Macro to remove a word in a specific heading level?
Hi,
I am hoping someone can help asnwer this question:
Let's say I have a word "XYZ" scattered throughout my Word document. That
Word document contains many heading levels, like:
1.
1.1
1.1.1
1.1.1.1
How do I write a macro that can remove "XYZ" only if it is in the 4th
heading level (e.g. 1.1.1.1, 1.1.1.2, 2.1.2.3, etc.)?
Also, how do I make it so the macro can also search for text blocks that
span multiple lines, like, for example,:
A
â?¢ B
C
â?¢ D
I want to be able to find and replace all text blocks that have exactly the
above format and everything, including the bullets.
Thanks. Tag: How to Reference to the IADs object Tag: 113222
Macro to remove lines containing specific text
I would like to be able to remove all lines from a Word document which
contain a specific text string and copy them to a second file at the same
time.
Can someone suggest some code that could do that?
I have seen similar posts in this forum which are close to my needs but none
that show me the code needed to both remove the entire line and append it to
a new file.
Thanks in advance
Al Tag: How to Reference to the IADs object Tag: 113221
Sending Emails in Groupwise 7
I have been using this code to send emails in Groupwise 6.5 with no problems.
With Groupwise 7, it fails at the .subject line with message
"Run Time error '91'
Object variable or with block variable not set
It does not like .subject, .addrecipient and yet it brings them up when you
type a period
docActive.SaveAs strTemp
docActive.HasRoutingSlip = True
With docActive.RoutingSlip
.Subject = "Gifts and Benefits Declaration from " & Me.txtAuthor
.AddRecipient strEmail(i)
.Delivery = wdAllAtOnce
End With
Any ideas please?
Stephen Tag: How to Reference to the IADs object Tag: 113210
Hyperlink in a macro comment
I'm trying to set up macros to streamline grading essays, and I want to
include hyperlinks in comments that I have created as commands on a new menu.
I create each command as a macro that inserts a comment with text about the
error I've found, but I can't figure out how to include the hyperlink in the
text that is in the comment. When I record the macro, I can type in the URL
as part of the text in the comment, but it isn't hyperlinked. So, for
example, I've created a menu in Word called "Sentence Errors" and each
command inserts a comment regarding a particular type of error. Here is an
example fo the type of text I want to include in a comment:
You seem to be having some trouble shaping your sentences so that they read
clearly and smoothly. Try reading your words out loud. Often your ear can
help you determine if your writing is awkward. You should also visit
http://owl.english.purdue.edu/owl/resource/604/01 to review the various ways
in which sentences can be structured.
But I want the Purdue link to be active within the comment, so the students
can simply click it from their graded essays. Is this possible? Tag: How to Reference to the IADs object Tag: 113204
Edit/Replace Text within Hyperlinks
I have a .doc which has about 35 hyperlinks to a shared folder. I would like
to do an edit/replace of "2007" with "2008" across all hyperlinks.
Example:
Hyperlink is
\\MyServer\FolderXXXX\SubFolder\PlanningTools\2007\_Category\2007Priorities
byChannel.ppt
Replace with:
\\MyServer\FolderXXXX\SubFolder\PlanningTools\2008\_Category\2008Priorities
byChannel.ppt
Does anyone know of an easy way to do this? I'd rather not edit each
individually...
Thanks
TOMB Tag: How to Reference to the IADs object Tag: 113196
Question on Ranges
Dear Programmers,
I am stumped about why "oRange" is doing what it is doing and wondered if
someone could explain it to me (and/or point me in the right direction). We
are using Word 2003 and the macro is in VBA. Here is my code (it's from the
very beginning of the macro):
Dim oRange As Range
Set oRange = ActiveDocument.Tables(2).Range
With oRange
'collapse oRange to a point at the end of Table 2:
.Collapse wdCollapseEnd
'insert next-page-section-break right after Table 2:
.InsertBreak wdSectionBreakNextPage
'insert a paragraph right after the section break:
.InsertParagraphAfter
'
'If I understand correctly, the insertion point
'at this point should still be where oRange was
'collapsed--at the end of Table 2.
End With
oRange.Select
With Selection
.TypeText "TOC"
End With
'
' But here, "TOC" appears right after
' the inserted paragraph, not right
' after Table 2. Isn't oRange now still
' just a point after Table 2?
Any feedback greatly appreciated.
Thanks so much!
-Lynne Tag: How to Reference to the IADs object Tag: 113195
Word 97 Macro to Create Outlook '03 Email With Text Format
Perhaps this should be in the Outlook discussion group, but I use a Word 97
macro that creates an email with Outlook 2003.
That email uses the contents of the current Word document as the body of the
email.
Test formatting is lost in the process. Any way to maintain (bold,
underline, colour, etc.)?
Thank you.
PS: The macro is from http://word.mvps.org/FAQs/InterDev/SendMail.htm:
Sub SendDocumentInMail()
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
'Outlook wasn't running, start it from code
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
'Set the recipient for the new email
.To = "recipient@mail.com"
'Set the recipient for a copy
.CC = "recipient2@mail.com"
'Set the subject
.Subject = "New subject"
'The content of the document is used as the body for the email
.Body = ActiveDocument.Content
.Send
End With
If bStarted Then
'If we started Outlook from code, then close it
oOutlookApp.Quit
End If
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub Tag: How to Reference to the IADs object Tag: 113193
How can I Have the TAB key function normally in a Form text field.
When I'm in the Form text field environment, when using my TAB key, it jumps
to the next field or the top.
How can I have my TAB key funciton within the Form text field similar to a
text area in a word document? Tag: How to Reference to the IADs object Tag: 113190
How to achieve editable word document with 95% protected in this c
Hi,
I am working with word-2003 templates having macro forms in it.
I use auto-text entries of 15-20 pages along with bookmarks giving options
to the
user in macro VBA forms to enter the fields . The user can insert the name,
address and check or uncheck the desired autotext entries(i.e autotext
entries have bookmarks where the bookmark text will be later replaced by the
user inserted fields). After insertion, the generated document will be
protected. There is a problem in the protection of this generated document
from template. I need the generated document (i.e after user entered his
requirements in the forms of template) to be protected in such a way that
user can make changes only to specific bookmarks in the generated document
(i.e even for auto-text entered bookmarks- name, address, etc in the
protected document). The generated document should be well protected allowing
only changes in the required bookmarks. Can you help me in the option of
editing the bookmarks in the generated document(i.e protected one)? Is there
any macro forms VBA code to do? or Should i use of the MS word protection
options only?
In Word-2003, I see the option of editing desired text in the protected word
document directly. I am unable to load the autotext entries with editing
enabled bookmarks.
In Macro VBA forms , I noticed the four options ActiveDocument.Protect( )
[wdallowonlyreading, wdallowonlyformfields,wdnoprotection,etc]. I am unable
to get my required result. Can any MVP help me in this issue? Tag: How to Reference to the IADs object Tag: 113177
COMException when editing range and HRESULT: 0x80010105
Hi all, I'm not sure if this is the right place to post this, but:
I am trying to work with the PIA for microsoft word from VS2008, framework
3.5. I am working in a class library with a reference to the Office 12 PIA.
I have Office 2003 (only) installed.
I am getting a lot of exceptions I do not understand and I cannot find
documentation to explain, so any help would be greatly appreciated (as well
as documentation, if anyone knows of any).
First, trying to edit a range is always throwing an exception, whether it in
this format (I'm just pasting some of the relevant lines from the code):
oTable = doc.Tables[iTable]
oRange = oTable.Rows[iRow].Cells[3].Range;
oRange.Text = ""; // exception thrown here
Or if the last line is written like this instead:
object count = oRange.Characters.Count;
object charUnit = WdUnits.wdCharacter;
oRange.Delete(ref charUnit , ref count); // throws exception
In the second case the exception message is:
"Cannot edit Range."
In the first case I get HRESULT: 0x80010105 exception where the code stack
shows that the exception occurred in "set_Range" method in the RPC server.
Here are two more examples that return this same HRESULT: 0x80010105:
The last line in this code that is working with a Document word object
(called "doc") throws an exception:
Range oRange = doc.Content;
oRange.Find.ClearFormatting();
oRange.Find.MatchWildcards = true;
oRange.Find.ParagraphFormat.Alignment =
WdParagraphAlignment.wdAlignParagraphCenter; // throws exception
The following line also throws an exception:
oTable.Cell(iSide1Row, 2).Range.Text = strOriginal;
Where I've checked that both "strOriginal" and "oTable.Cell(iSide1Row,
2).Range.Text" evaluate to proper strings.
Tell me if you need to see more code. Tag: How to Reference to the IADs object Tag: 113176
Deleting user-defined paragraph styles that have got "_Diss" at the
Dear Experts:
I'd like to delete all custom-defined paragraph styles in a document.
All these user defined paragraph styles have the following syntax
(*_Diss). How can I delete all theses styles in one go using Word VBA.
Help is appreciated. Thank you very much in advance.
Regards, Andreas Tag: How to Reference to the IADs object Tag: 113172
OrganizerCopy Problem
I'm trying to copy a macro from the active document to a document
which has just been created. The macro is not in the Normal.dot
template, just in the active document. The code looks like:
Dim DocA As Document, DocB As Document
Set DocA = ActiveDocument
' Create new document
Set DocB = Word.Documents.Add(DocA.AttachedTemplate.Name)
'Copy macro to new doc
Application.OrganizerCopy Source:=DocA, _
Destination:=DocB, _
Name:="CreateCustom", _
Object:=wdOrganizerObjectProjectItems
I'm having two problems: first, I get a "Run-time error '4149': File
not found" error unless the current folder for Word is the the folder
with the two documents. Second, when the current folder is set to the
folder with the two documents, I get "Run-time error: '5940': The
project item cannot be copied.
The examples I've found for this have a .dot file for the source, but
I don't know what to do in this instance.
thanks in advance, dave Tag: How to Reference to the IADs object Tag: 113171
How Does One Add a Page Number to a Header?
I would like to create a header so that: â??Add Title Hereâ?? appears on the left
side of the page, and â??Page {PAGE}â?? appears on the right side of the page. So
far I got:
Sub AddHeader()
Dim oRange As Range
Set oRange = ActiveDocument.Range(Start:=ActiveDocument.Range.Start,
End:=ActiveDocument.Range.End)
With oRange.Sections(1).Headers(wdHeaderFooterPrimary).Range
.Delete
.Paragraphs.Alignment = wdAlignParagraphLeft
.InsertAfter "Add Title Here" & vbTab & vbTab & "Page "
End With
End Sub
I would like a page number to follow: "Page ", I wish I could just add: &
vbPageNumber, but I suspect that it will be more complex than that.
Any help will be greatly appreciated.
Steven Craig Miller
P.S. I apologize for having wrongly placed a duplicate message in Word Tables. Tag: How to Reference to the IADs object Tag: 113170
deleting form fields
I want to create a template form that after the document is created and
saved, the user can Open the saved document, run a "macro??" and delete only
specific fields in the form in one pass.
The original forms has ~200 fields. We want to be able to reOpen the
previously saved document, keep ~50 fields from the original and blank (or
Delete) the remaining ~150 fields with a single command. The feilds are
always the same.
What is the best way to solve this? I thought of building a macro but when
you run the macro on the filled in form, it takes a long time to remove the
fields in the document when the author is ready to type. VBA seemed like a
better option but I'm not as familiar.
Using Word 2003 on XP.
Thanks,
philr Tag: How to Reference to the IADs object Tag: 113169
Word 2007 Not responding
I have the following macro that works fine in Word 2003. But when I try and
run it Word 2007 it locks up. I do not get an error message, Word 2007 just
stops responding. Any help would be appreciated.
On Error GoTo endthis
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.ParagraphFormat
.Alignment = wdAlignParagraphLeft
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "NOTE:^w"
.Replacement.Text = "NOTE:^t"
.Format = False
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute Replace:=wdReplaceAll
Do While Selection.Find.Execute(Replace:=wdReplaceOne)
If Selection.Information(wdWithInTable) Then
With Selection.ParagraphFormat
.KeepWithNext = True
.KeepTogether = True
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
End With
Selection.Collapse Direction:=wdCollapseEnd
Else
If Not Selection.Information(wdWithInTable) Then
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.ParagraphFormat
.Alignment = wdAlignParagraphLeft
End With
Selection.Font.Underline = wdUnderlineNone
Selection.Words(1).Font.Underline = wdUnderlineSingle
Selection.Paragraphs(1).Range.Select
Selection.ConvertToTable Separator:=wdSeparateByParagraphs, NumRows:=1,
numColumns:=1, _
DefaultTableBehavior:=wdWord9TableBehavior,
AutoFitBehavior:=wdAutoFitFixed
Selection.Tables(1).Rows.SetLeftIndent LeftIndent:=44,
RulerStyle:=wdAdjustNone
Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=423,
RulerStyle:=wdAdjustNone
Selection.ParagraphFormat.Style = "tlNormal"
Selection.ParagraphFormat.TabStops(InchesToPoints(0.5)).Position = _
InchesToPoints(0.63)
With Selection.ParagraphFormat
.LeftIndent = InchesToPoints(0.63)
.KeepWithNext = True
.KeepTogether = True
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
End With
With Selection.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.FirstLineIndent = InchesToPoints(-0.63)
End With
Selection.Collapse Direction:=wdCollapseEnd
End If
End If
Loop
endthis:
Selection.HomeKey wdStory Tag: How to Reference to the IADs object Tag: 113168
Macro fine in Word 2000... breaks in Word 2002...?
Howdy,
I recently moved from Office 2000, to Office XP.
I have a bunch of macros that I built (in Word 2000) by
recording, and tweaking, rather than by having any real
understanding of VBA.
They worked fine, but...
Now that I run Word 2002, some of the macros choke.
The one below (with apologies for all the junk my recording
method includes) hangs at the pause that I have marked with
"XXXX", but will not run if I rem that line out.
'
' NameTagsFirst Macro
' Macro created 5/30/2002 by Kenneth
'
'
Documents.Add Template:= _
"F:\Templates\Label 4x2.dot" _
, NewTemplate:=False, DocumentType:=0
Documents.Open FileName:="Z:\Data\let.txt",
ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False,
PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
Selection.TypeText Text:="First" & vbTab
Selection.TypeParagraph
ActiveDocument.Save
ActiveWindow.Close
Selection.Font.Size = 36
Selection.Font.Bold = wdToggle
ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters
ActiveDocument.MailMerge.OpenDataSource
Name:="Z:\data\let.txt", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="",
WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="",
SQLStatement:="", SQLStatement1 _
:=""
ActiveDocument.MailMerge.EditMainDocument
ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="First"
Selection.TypeParagraph
' ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="Last"
SendKeys "~"
ActivePrinter = "OKI"
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True XXXXXXXXXXXXXXXXXXXXXXX
End With
ActivePrinter = "Printer Color"
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Application.ScreenUpdating = True
Application.Quit
Might you assist in getting this to run properly?
Many thanks,
--
Kenneth
If you email... Please remove the "SPAMLESS." Tag: How to Reference to the IADs object Tag: 113167
How to reverse only words into sentense by StrReverse function?
Hello.
I need to turn over all words in selected text by StrReverse function.
But these words should be in right order (like in sentense). Reversing
should be only for words, not for all string. For example, I do that:
Sub reverse()
Dim strStroka As String
Dim strRev As String
strStroka = Selection.Text
strRev = StrReverse(strStroka)
Selection.Text = Replace(strStroka, strStroka, strRev)
End Sub
This code is reversed all string. Thus the order of words into
sentense is broke. I try it otherwise, but I stop by using of cycle:
Sub reverse2()
Dim myArr() As String
Dim i As Integer
Dim sStr As String
Dim strRev As String
sStr = Selection.Text
myArr = Split(sStr)
For i = 0 To myArr(sStr) 'this is error
strRev = StrReverse(sStr)
Selection.Text = Replace(sStr, sStr, strRev)
Next i
End Sub
Help me, please.
Thank you very much. Tag: How to Reference to the IADs object Tag: 113161
How to highlight text from the cursor's current position down to a
Hi,
May I ask how to write a macro that highlights text from the cursor's
current position down to any specific word, let say "name", in the
word document? Then, I want to delete the highlighted text. Thank
you.
Mike Tag: How to Reference to the IADs object Tag: 113159
Beginning XML
Word Professional 2003
I am anxious to get started with learning at least the basic inâ??s and outâ??s
of working with XML. However, I seem unable to either locate or install from
the â??templates and add-insâ?? feature any schemas for use in beginning this
process.
I would be very appreciative of anyone who may perhaps be able to shed any
light on this situation for me as to how I might proceed.
Thanking you in advance â?? Rod Tag: How to Reference to the IADs object Tag: 113153
Multiple Hyperlinks in Table Cell
Hi,
Thanks in advance for any help. I am trying to add multiple
hyperlinks, separated by a return, in a table cell.
I can add the hyperlink:
objRange = objTable.Cell(5, 2).Range
objDoc.Hyperlinks.Add(objRange, strEachLink(1), , , strEachLink(0))
Now I need some spacing between this link and the following link, so I
have tried this:
objTable.Cell(5, 2).Range.Text += Chr(11)
However, that removes the hyperlink from the text. Anytime I try to
append any text to the cell, it removes the hyperlink.
What am I missing or where is my logic wrong causing this to not work? Tag: How to Reference to the IADs object Tag: 113151
Disable this error dialog with a macro?
Paste Special links have been placed throughout a template, that allow people
to enter repetitive information only at the first occurrence, and whatever
they type automatically updates other Paste Special links interspersed
throughout the template, eliminating redundant keyboarding and reducing typos.
But Word insists on displaying an 'error message' whenever people use this
template, misleadingly warning them that "this document
contains links that may refer to other files. Do you want to update this
document with the data from the linked files?"
In this case the links do NOT refer to other files; they are simply internal
links
intended to function as planned, so this intimidating error message is
misleading and rattles users, who tend to answer "NO", which compromises the
utility of the template.
Can this 'error' message be disabled via a macro? Tag: How to Reference to the IADs object Tag: 113144
Programming Word
I use OLE to offer Word as an editor for Rich Text and HTML from within my
app. I would like to extend this and write in info at the top of the Word
screen above the actual document.
That is, I would like to programmatically enter a TO, FROM, SUBJECT above
the actual body of the document that is not part of the document, and that
displays below the existing toolbars and above the document body, much like
Outlook does with email. In some cases, the user need not make edits to
this, but it is only for display.
Does anyone know if this is even possible? Does anyone know of a reference
book or article to help me complete this task, or any other advice?
Thanks for any and all ideas on this,
Mark Tag: How to Reference to the IADs object Tag: 113143
Is it possible to assign own number format for the footnotes?
Word 2003. When I insert the footnote I see the dialogue "Footnote and
Endnote". In group "Number format" there is number format 1,2,3, at
alias. But I need to other format: 1), 2), 3) etc.
Question: Is it possible to assign own number format for the
footnotes or not? And in Word 2007?
Thank you. Tag: How to Reference to the IADs object Tag: 113142
multiple users
I just got a new computer with Windows vista, and have 2 user accounts. i
cannot get office to show on both accounts. How do I fix it? Tag: How to Reference to the IADs object Tag: 113133
Is probably changes some elements into some documents at once?
There is the batch of the documents with some identical elements:
letterhead (it not header and footer ). In that letterhead it will
changes couple of elements. Maybe more.
I will change those elements only in one document.
Question: is it probably and how to do change into all documents at
once?
I think to use the fields (REF), but how do this do from one document
for other documents? Tag: How to Reference to the IADs object Tag: 113132
Insert Blank Pages Macro
I have an Access report that I brought into word, and I want to insert two
blank pages after the first (title) page. The first inserted page (second pg
overall) I need in landscape format, and the second inserted page (third pg
overall) I need portrait, like all the other pages except #2. I can do this,
but when I record the macro for it and run it, puts the inserted pages at the
beginning, and messes up the spacing to where it adds about 10 pages to an
80pg document. Any help would be appreciated. Let me know if I should post
the code for the recorded macro. Thanks a lot. Tag: How to Reference to the IADs object Tag: 113130
automation of adding ref number
Hi All,
I need to write a small vba macro, to enable the following.
(Both 2003 and 2007)
Open a template, insert a reference number (one up each time) and save
the file (before it's been edited)
To be saved in the same directory each time (guess what called quotes).
File ref number to be incremented every time the macro is run. In the
following format.
RSTU-xxx-xxxxx
RSTU will be the inits of the user
xxx will be the day count
xxxxx will be the incremented ref number.
The reference number will be held on a server so that the adapted macro
(for each user) will always be taking the number from there.
Any help much appreciated.
Kevin
--
I live in my own little world,
But it's OK, they know me here....
++ Kevin J Prince ++ Tag: How to Reference to the IADs object Tag: 113128
Learn English!!!! Change ur language and you change ur thoughts.
Learn English!!!! Change ur language and you change ur thoughts.
Learn English and free download Grammar & dictionary.
Just click the website and share ur thoughts=85.
=93Give a man fish and he=92ll eat once!
Teach a man to fish and he=92ll eat for a lifetime=94.
http://Onlinespokenenglish.googlepages.com/home Tag: How to Reference to the IADs object Tag: 113121
Adjusting Cell properties by macro?
Greetings,
I'm very familiar with Excel macros and VBA, but new to this with Word. I
want to record a macro to adjust cell properties, but when I start recording
the macro, I lose the ability to right-click! (Anyone know how to overcome
this?)
Anyway, for various reasons, I need a macro to adjust cell margins.
Normally, this is done by right-clicking a cell, selecting "Table
Properties"-->Cell tab-->Options button-->Cell margins, and setting all
values to zero. (Default value is 0.08 for two of the margins.)
Does anyone have a suggestion as to a good way to create a macro for this
menial task? Thanks! Tag: How to Reference to the IADs object Tag: 113117
Save HTML without Word Styles?
I integrated Word97 with a Windows application that allows users to create
simple HTML content in Word97. The content is small blocks of text with
simple formatting such as bold, italics, color fonts, H1, H2. These blocks of
text are stored in a database. The data is uploaded to a web site. When the
web application is run, these little blocks of text with their simple HTML
formatting are displayed by the web application. I am in the process of
upgrading the Windows application to run on XP and to integrate with
Word2007. Lo and behold, the format of the HTML code saved in Word 2007 is
not the simple HTML commands as before. How can I save HTML in Word 2007
without saving all the explicit Word styles? I discovered HTML, Filtered, but
it doesn't eliminate all of the Styles. There is a "Rely on CSS for font
formatting" setting on the Browsers tab under Web Options (Word
Options/Advanced), but there is nothing about this in the documentation. The
web site does have a CSS, and it would be great to be able to reference it. Tag: How to Reference to the IADs object Tag: 113115
Word 2003 / 2007 Compatibility Issue
This might be a question better suited for the General forum (which I've
cross-posted to - I think), but the issue is related to documents created
from templates that I've coded so I'm posting in the Word Programming forum
as well.
Here's the situation: I've created a series of templates using Word 2003.
These templates have protected and unprotected sections in them (forms
protection). The client has standardised on Word 2003 across the
organisation, but there are a couple of "high-ranking interested parties"
(members of the Board) who are running Word 2007. I've been told - but have
yet to see proof - that when documents created from my templates are opened
in Word 2007 only the content in the protected area/s of the document is
displayed; the unprotected sections are blank. ~cue spooky music~
Unfortunately I don't have a copy of Word 2007 to test with, and the persons
reporting the problem are not exactly local, so I'm unable to reproduce the
problem myself. However, before I go too much further with chasing this issue
(which I'm tempted to resolve by saying it's out of scope since the contract
was to develop templates for use in the _standard_ environment), I'd like to
know if anybody else has encountered this problem.
--
Cheers!
Gordon
The Kiwi Koder
Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup. Tag: How to Reference to the IADs object Tag: 113114
Nonbreaking space
I want to find all occurrences of â??Figure(space)numberâ?? and change it to
â??Figure(Nonbreaking space)Numberâ?? where the number can be 1 to 9.
I have the following but it finds all occurrences of the work "Figure " and
I'm looking for Figure 1, Figure 2 and so on.
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Figure "
.Replacement.Text = "Figure^s"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With Tag: How to Reference to the IADs object Tag: 113110
Procedure - wide error handling
I am needing to create error handling for my program. I have one main
procedure that runs on a start button. I don't forsee any errors occurring
with the project, but with my type of users, that will most likely be my
downfall. I have decided that error handling will be needed, but the code
will not compile. Keeps giving "Label not Defined" errors. Is there a way
to catch any error witn the procedure, create an email to me which the users
will tell what error code they encountered and where, then terminate the
program? Below is my current code...
Private Sub CmdRun_Click()
On Error GoTo 1227
'
'
' lots of code
'
'
Dialogs(wdDialogFilePrint).Show
PPSPrintForm.Show
ActiveDocument.PrintOut (Background = False)
If Err.Number <> 0 Then
MsgBox "An error has occurred, the program will now terminate and
create an troubleshooting email. The error message number is:" & Error(Err)
DoCmd.SendObject acSendNoObject, , , "myemail@myemailaddress.com"
Err.Clear
Application.Quit
End If
End Sub Tag: How to Reference to the IADs object Tag: 113107
Jean-Guy ? One click highlighting of table cells
Hi Jean-Guy (or anyone else who can help),
Sorry for all these posts but it would be so satisfying to find out if and
how this can work.
I have a word document with a table of options to choose from. Each Row
contains descriptions which will be rated as Excellent (5) Good (4)
Satisfactory (3) Poor (2) and Unsatisfactory (1).
At the moment users print the document out, highlighting and scoring in pen.
Well we want to get all modern and have them do it electronically..... !
What I would like to do is have a way of clicking 1 cell in each row and
then it highlights that cell. Jean-Guy provided a way of doing it that was
working brilliantly until I came across something that said that Activex
Controls aren't compatible with Macs. No control over what OS users will use
so may be problem.
Then greedily or overoptimistically would like to automatically score each
row and sum each column then all columns. Thought I could do that by using
Text forms - calc on exit and then sum in last row, using sections to have
Activex on unprotected parts of form and Form Controls on protected parts. It
meant 2 entries per answer but would have been ok if not for the possible
problem of Macs and Activex controls.
Any suggestions/solutions would be fantastic!!!
Thank you - sorry for long post
--
Mifty Tag: How to Reference to the IADs object Tag: 113089
Are Controls from the Control Toolbox compatible with Macs
Hi everyone,
Jean-Guy Marcil gave me a solution for one click highlighting of tabel cells
earlier
http://www.microsoft.com/office/community/en-us/default.mspx?&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.word.vba.general&p=1&tid=02b14904-0fc9-4cbd-9daa-bc512dcaae6c
This uses controls from the control toolbox. I have no idea what computers
the final users of the form have and read somewhere that Activex Controls
won't woek with Macs.
Could it be a problem for me or am I getting totally confused.
Many thanks
and thank you to Jean-Guy for the earlier help
--
Mifty Tag: How to Reference to the IADs object Tag: 113080
Can you create a word macro that has a choice for the user?
I'd like to create a macro to insert a file into the existing document and
clean up clashes between the two, but i want the user to have the choice of
which file to insert, which is in the middle of the macro. Tag: How to Reference to the IADs object Tag: 113070
Word crashing when printer tray is changed in vba
For some time now I have had some printer switching routines detailed on my
web site http://www.gmayor.com/fax_from_word.htm and they have always worked
in the past ... until recently when I responded to a question in the mail
merge group to a user who found that Word crashed when the tray options were
selected. The following sample code should show the problem (change the
printer name to a valid printer that is not the default printer and which
has a tray 2 assignment available:
Sub HPPrint()
Dim sPrinter As String
Dim sTray As String
sTray = Options.DefaultTray
With Dialogs(wdDialogFilePrintSetup)
sPrinter = .Printer
.Printer = "HP LaserJet 4050 Series PCL"
.DoNotSetAsSysDefault = True
.Execute
End With
Options.DefaultTray = "Tray2"
MsgBox ActivePrinter & vbCr & Options.DefaultTray
'Dialogs(wdDialogFilePrint).Show
With Dialogs(wdDialogFilePrintSetup)
.Printer = sPrinter
.DoNotSetAsSysDefault = False
.Execute
End With
Options.DefaultTray = sTray
MsgBox ActivePrinter & vbCr & Options.DefaultTray
End Sub
I find this invariably crashes Word 2003 (sp2 and sp3) and in Word 2007 the
line
Options.DefaultTray = "Tray2"
is ignored
Even using the simpler
Sub HPPrint()
Dim sPrinter As String
Dim sTray As String
sTray = Options.DefaultTray
sPrinter = ActivePrinter
ActivePrinter = "HP LaserJet 4050 Series PCL"
Options.DefaultTray = "Tray2"
MsgBox ActivePrinter & vbCr & Options.DefaultTray
ActivePrinter = sPrinter
Options.DefaultTray = sTray
MsgBox ActivePrinter & vbCr & Options.DefaultTray
End Sub
the same results apply?
I had suspected Acrobat may have been the problem, but I uninstalled that
and the problem remains.
Is anyone else experiencing this problem?
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<> Tag: How to Reference to the IADs object Tag: 113066
Problem with Word SendKeys command
I'm using Word 2007 trying to set up a very simple macro that would get me
into the Keyboard Customization dialog (there doesn't seem to be a command to
get there). Previously I've used the SendKeys command for this, but it
doesn't seem to work, ie nothing at all happens. The string is
"%FIC{Tab}%TMM{Tab}". But even when I put in a very simple string eg:
SendKeys "A" (that's the entire macro) nothing happens. Does anyone know
what's going on and how to fix it. Tag: How to Reference to the IADs object Tag: 113062
insert file
I am using the following code to insert a file into a template.
"
Dim myDoc As Document
Dim docrange As Range
Set myDoc = ActiveDocument
With myDoc
.Unprotect
Set docrange = .Range
docrange.Collapse wdCollapseEnd
docrange.InsertBreak wdSectionBreakNextPage
Set docrange = .Range
docrange.Collapse wdCollapseEnd
docrange.InsertFile "W:MN Collective Bargaining Letter.doc"
.Protect wdAllowOnlyFormFields, NoReset
End With
The template has letterhead, so this code adds a section break.
What I want to do is just add the file due to size of the page.
The file to insert has a wider left and right indent so everything fits on
the page.
When I insert, does the file inherit the indent and margin of the template
or of it's own.
If it inherits the template, how can I change the left and right
indentation, margins,
etc.?
Thanks ,
Bryan Tag: How to Reference to the IADs object Tag: 113060
Help with VBA Help
I have Office 2003 Pro running under XP, everything is fully updated and
patched. I also made sure to install the help system for VBA as "Run From
Computer" during the custom installation. However, when I start the help
system using the VBA window in Word (or Excel), and search for a statement,
none of the search results do anything when you click on them. In
contrast, clicking on a search result after searching for a Word command in
the Word help menu brings up the help subsystem.
I've searched google/groups and seen others have had what sounds like the
exact same problem but there were no resolutions. What do I need to do to
get the VBA help system working in Office 2003?
Thanks,
Bill Asher
p.s. I posted a similar question in one of the Excel groups here. I
apologize for the dual post. I didn't find this group until after I
submitted the first one or I would have just cross-posted that one. Tag: How to Reference to the IADs object Tag: 113049
Combo box drop down list
I need the dummies version of how to add a drop down list to a word document
please. I've tried using help but it's not helping! I need to create a
picklist with about 25 choices. The selection will need to result in another
field auto-populating, but at this point I just need to know how to populate
my pick list.
THANK YOU SO VERY MUCH in advance!!! Tag: How to Reference to the IADs object Tag: 113047
convert from 2007 to 2003
Does anyone have a way to quickly take a set of word documents that are in
2007 format and save them as 2003 format? I don't want to have to open each
document, then click saveas, then choose 97-2003. And I don't want to set my
options to always save to 97-2003. It seems like maybe a macro could do it,
but I don't know if that will produce the easiest method for the end-user or
if it's even possible. Any advice is greatly appreciated. Tag: How to Reference to the IADs object Tag: 113045
Line number in Table
I am creating text from an Access database and placing it into a Word table
and need to keep track of the current line number so that if the text is less
than a full page I can set the row to not break across the page otherwise I
want to allow the row to break and have the text visible on the next page.
If there is too much text and I leave the row to not break then not all the
text is visible.
Thanks in advance for any suggestions.
Jerry Tag: How to Reference to the IADs object Tag: 113044
Activate check box form field
Using Word 2003, I wish to use programming to check a check box that was
added using the Forms toolbar. My current code using the following line to
locate the check box, which is bookmarked as "Plumbing":
ActiveDocument.Bookmarks("Plumbing").Range.Select
What code can I use to then check the check box (i.e., place an X in it)?
Thanks!
--
Steve C Tag: How to Reference to the IADs object Tag: 113043
drop list & macro
I am experiencing a similiar problem. I used forms to create a drop down
list and generated a macro by recording information in a below section of a
template. I am trying to determine two things.
1. Bookmark my macro, because right now the macro will only display where
the cursor is.
2. Make the selection of the drop down list to auto populate the desired
selection.
Please help!!!!!!!!!!!!!!!!!!! Tag: How to Reference to the IADs object Tag: 113042
Continuation Header Fields
MS Word 2003
I have a template that uses macros to put continuation header fields on the
pages. (I've included a sample macro below.) This template uses 7 outline
levels, and two of those levels have different types (for instance "Level 2
TOC" and "Level 2 Text"). When the continuation headers are applied, they
look for the appropriate text styles and then append the one from the level
above to create the string. These continuation headers are applied by user
selection (they're not automatic). This results in something like 25
different menu selections, based on how the user formats the steps before the
continuation header they want to insert.
I'm wondering if there is a way to use just 7 different macros. One for
Level 1, one for all forms of Level 2, one for all forms of Level 3, etc. Any
ideas?
Outline levels (with continuation header examples):
Lev 1 (ex: 5.0)
Lev 2 TOC (ex: 5.1)
Lev 2 (ex: 5.1)
Lev 2 Act (ex: 5.1)
Lev 2 Txt (ex: 5.1)
Lev 3 TOC (ex: 5.1.1)
Lev 3 (ex: 5.1.1)
Lev Prereq (ex: 5.1.1)
Lev 4 (ex: 5.1.1.A)
Lev 5 (ex: 5.1.1.A.1)
Lev 6 (ex: 5.1.1.A.1.a)
Example macro:
Sub StepCont4()
'
' StepCont Macro
'Macro adds a page break and references the last heading 4 style
'
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.InsertBreak Type:=wdPageBreak
Selection.Style = ActiveDocument.Styles("Normal")
'This adds the field for finding the last heading 3
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeBackspace
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="styleref \n ""heading 3"
Selection.EndKey Unit:=wdLine
'This adds a separator of .
Selection.TypeText Text:="."
'This adds the field for finding the last heading 4
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeBackspace
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="styleref \n ""heading 4"
Selection.EndKey Unit:=wdLine
'This adds the words for continued
Selection.TypeText Text:=" (Continued)"
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
'This toggles and updates the codes
Selection.Fields.ToggleShowCodes
Selection.Fields.Update
Selection.EndKey Unit:=wdLine
End Sub Tag: How to Reference to the IADs object Tag: 113041
I want to connect to Active Directory and I need to use the IADs object.