using for each to select sentences in a cell
Hi,
I have managed to find a work around to my current problem but I am
intrigued as to why this is happening.
Word 2003
I am extracting individual lines out of a Table cell and placing them
in a collection which i am placing in a user form to provide a user
interface.
Previously i would have iterated over the string until i found a
carriage return / line feed character but after discovering the joys
of the Word Range object (thanks to the contributions in this group!)
I thought there must be a much more elegant solution.
Which i thought would be along the lines of Tag: WORD SpellCheck, Add to Dictionary button Tag: 115647
Find each text box
I want a way for a user to find each text box in the main story of a
multi-section document - kind of like 'browse by object' for text boxes - so
they can see whether or not the box should be deleted.
I don't see the option for searching for shapes in find, and I don't want to
do anything with the text boxes except maybe select them if necessary.
Any suggestions would be most appreciated, but I'm not an experienced vba
writer so comments associate with the code would really help.
--
Thanks, Jen Tag: WORD SpellCheck, Add to Dictionary button Tag: 115640
Bookmark REF Field
I have a template with several Form Fields. I would like to put in a
FormField that is automatically filled in with data that comes form three
other bookmarks. this FormField is a Report ID. The Report ID would be made
up from three different Bookmarks/Fields that the user fills in, such as
UserInitials, FiscalYear and State. The Review ID would automatically update
to ELB2008CA after the user enters the data for UserInitials, FiscalYear and
State.
Does anyone know how I could do this?
Thanks
--
Eric the Rookie Tag: WORD SpellCheck, Add to Dictionary button Tag: 115635
Form Fields Reset
I have a template with several Form Fields, REF Text and a TOC. I have a
macro that updates all Fields on the tool bar that allows users to update
fields when the Doc is protected. But the Form fields get reset when the
user uses this macro. Please help.
Sub UpdateFields()
'
'
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub
--
Thanks
Eric the Rookie Tag: WORD SpellCheck, Add to Dictionary button Tag: 115634
How to handle pressing button "Cancel" from InputBox?
Hello.
How to handle of pressing button "Cancel" from dialogue InputBox? In
my code when user press button "Cancel" dispaly Msgbox from cycle Do
While. I need to cancel all action. See my code:
Sub movePic()
Dim Message As String
On Error Resume Next
If Selection.Type = wdSelectionInlineShape Then
Selection.InlineShapes(1).ConvertToShape
End If
If Selection.Type = wdSelectionIP Then
MsgBox "Please select your image"
Else
Do While Message = ""
Message = InputBox("Please enter the number." & _
vbCr & "...", _
"Move image", "")
If Message = "" Then
MsgBox "Please enter the number"
End If
Loop
Selection.ShapeRange.IncrementLeft MillimetersToPoints(Message)
End If
End Sub
Thank you very much! Tag: WORD SpellCheck, Add to Dictionary button Tag: 115630
Word 2007 formatting from elements/fields disapear
L.s,
I use the Dutch version, so I hope I translated the menu's fine. Also i
wonder if this is the right group for this question?
I have made a template for users en put the new "besturingselementen"
elements where the user can put in text, in the template. I fount this on the
developer tab, group elements and then the new ones (not the old 2003 or
really old 1998).
I choose the element without formatting and set it up to "disappear" when
the user changes the default text. It works fine until here.
I want to mark the places where the user need to make changes, I mark the
default text which is in the field/element with the "yellow text marker". Now
the user can easily see where to make changes. What works really nice is that
when the user chances the text, the element AND the marking will disappear. I
don't know if this is intended or a "undocumented feature" but it's a great
option.
And now the big problem:
In my documents there are many elements when I change the marking for some
of them it's looking fine, but when a save, exit and reopen the file, the
marking for other elements is gone.
I tested for several hours but can't find some logic in it. I tried:
- change the marking in developer mode (yes/no). for the elements.
- In developer mode when changing the marking include/exclude the label
marking round the element (where the text you can put in as "label" is
placed).
- Give every element a unique label name
- etc.
It drives me really nut's, I can't find any logic.
Does anyone know a solution for this puzzle
Manny thanks
Peter Tag: WORD SpellCheck, Add to Dictionary button Tag: 115626
GetCaretPos can't get the correct value
When i call GetCaretPos in MS Word Addin, It always return's a same value.
When i Enable IME,it can return the correct value. Some one can tell me why? Tag: WORD SpellCheck, Add to Dictionary button Tag: 115625
Formatting seems to pass from Form Fields to repeated fields
Hi All
Again, I'm using Form textboxes to enable a user to enter repetitive info in
one place and then use ref fields to display this info in various places
such as textboxes, table cells, etc, when the user tabs out of the relevant
form textbox.
My problem is that the initial form textboxes are something like 16 pt bold,
which they need to be and for some reason this formatting also goes to the
repeating fields, which is no good because I want the repeating fields to
remain in their pre-set states of 10pt normal, 9pt normal, etc.
Any ideas how I stop the formatting coming across?
Thanks Tag: WORD SpellCheck, Add to Dictionary button Tag: 115609
How to auto-display the forms toolbar and a macro to click on
Hi All
Having real trouble finding out how to do this.
Basically I have done a Word doc that uses Form fields so that I can
auto-copy the contents of say 20 form fields into designated areas of the
remaining doc.
My problem is that textboxes don't seem to auto-update when the user has
tabbed out of a form field (cells in tables do), so I've a little VBA macro
function that goes through all of the references and forces them to update -
inc the textboxes.
My problem is that I need the user to click the padlock icon on the forms
toolbar to unlock the doc so that the user can then click on this macro to
run it.
This 'unclick padlock then click Macro' procedure has to be done for each
copy of the Word doc template that they use, but the user is fine with that.
My functional problem is that I:
a) Can't get the Forms toolbar to be already displayed when the user opens
the copy doc from the template.
b) Can't get my Macro to appear as a clickable toolbar/item/button when the
user opens the copy doc from the template.
Although displaying the Forms toolbar isn't too much of an onerous task for
the user, ie they go View / Toolbars / Forms, getting the Macro to appear on
the menu/toolbar is way too much hassle.
Is there no way, either via VBA or something even more simpler, I can get
these details to auto-display as the user opens the copy doc?
Thanks Tag: WORD SpellCheck, Add to Dictionary button Tag: 115608
Create Table of Changes
I have multiple people reviewing multiple copies of the same document.
I need to merge all reviewed documents into a final document wich will be
created by taking the original document and adding the suggestions / changes
added in the appropriate places.
I am an excel VBA programmer & so far I can make a table of revisions (using
track changes) and a table of comments, but am unsure how to tag their
original location so that I can put them all back where they came from.
I would prefer to use revisions (needs only to work for inserted revisions)
but I could use comments as well.
Any insight / help would be appreciated. Tag: WORD SpellCheck, Add to Dictionary button Tag: 115605
save email message
I am trying to create the following sub to save an email message as an Excel
file. The Sub does search through the outlook folder and saves the message as
"Daily Processing Report.xls", but I get an error when trying to open it,
"File Format invalid". I am able to do this manually by opening the message
and doing a file save as and typing "Daily Processing Report.xls" and it
opens just fine. But when I do it manually it also saves a folder with the
same name and in it it has two xml files and one file with .thmx extension. I
want to be able to do this with a macro if possible.
sub extractEmailMessage()
Dim olApp As outlook.Application
Dim olNs As outlook.NameSpace
Dim olFolder As outlook.Folder
Dim olItem As outlook.MailItem
Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olFolder = olNs.GetDefaultFolder(olFolderInbox).Folders("Folder")
dirname = "D:\Emails\"
For Each olItem In olFolder.Items
If olItem.Class = olMail Then
olItem.SaveAs dirname & "Daily Status Report.xls"
End If
Next
End Sub Tag: WORD SpellCheck, Add to Dictionary button Tag: 115604
Date Field Clear
sGood Afternoon,
After checking the previous posts, I didn't see anything that quite fit what
I'm looking to do and I'm hoping someone can still help. The first program
below fills in two different ranges in the doc (one with the user id and the
other with the date). Unfortunately, it was brought to my attention that
someone might be a drooling moron and click on the box by accident which
would require a clear function.
The second program I tried to set up works to clear the Text Range
(BMRange), but will not clear the Date Field (BMRange1). I've tried several
variations and the best I can come up with what's below where it only deletes
the first text character.
Any thoughts on how to get it to delete the whole date line?
Thanks in advance - Jenny B.
Sub Bookmark()
Dim BMRange As Range
Dim BMRange1 As Range
Application.ScreenUpdating = False
With ActiveDocument
If .ProtectionType <> wdNoProtection Then
.Unprotect Password:="1"
End If
End With
'Identify current Bookmark range and insert text
Set BMRange = ActiveDocument.Bookmarks("Div").Range
Set BMRange1 = ActiveDocument.Bookmarks("Divs").Range
BMRange.Text = Environ("username") & " " & "Dividends"
BMRange1.InsertDateTime datetimeformat:="MMMM dd, yyyy", InsertAsField:=False
'Re-insert the bookmark
ActiveDocument.Bookmarks.Add "Div", BMRange
ActiveDocument.Bookmarks.Add "Divs", BMRange1
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True, Password:="1"
Application.ScreenUpdating = True
End Sub
__________________
Sub Clearboxes()
Dim BMRange As Range
Dim BMRange1 As Range
If ActiveDocument.FormFields("Check19").CheckBox.Value = False Then
Set BMRange = ActiveDocument.Bookmarks("Div").Range
Set BMRange1 = ActiveDocument.Bookmarks("Divs").Range
BMRange.Text = ""
BMRange1.Delete
ActiveDocument.Bookmarks.Add "Div", BMRange
ActiveDocument.Bookmarks.Add "Divs", BMRange1
End If
End Sub Tag: WORD SpellCheck, Add to Dictionary button Tag: 115603
Dialog not opening for selection
I have the following code is a test document (.doc) and it opens the dialog
box fine for me to select an image folder.
'
' select the folder
'
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show Then
myFolder = .SelectedItems(1)
End If
MsgBox ("Folder selected is " & myFolder)
End With
However, when I place that same code in a Word template (.dot) I see the
MessageBox displayed but the dialog box never appeared prior to that for me
to select the folder.
What am I missing? I am trying this in Word 2002 (XP) on WinXP SP2.
Mainer Tag: WORD SpellCheck, Add to Dictionary button Tag: 115602
Reading SQL database and retrieving document
VBA gerus,
I need my macro to read the name of a document from an SQL database on
a remote site and retrieve the named document for editing. After
editing, I need a macro to write/rewrite the document to the site.
Can this be done using VBA? Are there samples of syntax? Thanks.
Charlie from Texas Tag: WORD SpellCheck, Add to Dictionary button Tag: 115600
Reading SQL database and retrieving a file
VBA Gerus,
From a macro, I need to read a document's name from a SQL database on
a remote site, and retrieve the document. After editing, a macro
needs write/overwrite the file back to the site. Can this be done
from VBA?
Thank you,
Charlie from Texas Tag: WORD SpellCheck, Add to Dictionary button Tag: 115599
Cloning document content to new docs
I'm using the Word Object Model to work with the body of a new e-mail
message in Outlook 2007. My goal is to simply clone the active e-mail into
one or more copies (the recipients from the source will each get their own
copy of the original, which will be trashed). I'm tried using
Document.Select, then Application.Copy on the source e-mail, followed by
Document.Activate, Document.Select (the Document objects are specific to the
cloned item, not the source), Application.Selection.WholeStory and then
Application.Selection.PasteAndFormat(wdPasteDefault) on each newly cloned
e-mail. However, there are times when I get a locked for editing warning
and the cloning fails - empty message body; this occurs inconsistently.
Is there a better approach to cloning the contents of a Document object in
situations like this where the documents are not file based?
--
Eric Legault [MVP - Outlook]
MCDBA, MCTS (Messaging & Collaboration, SharePoint Infrastructure, MOSS 2007
& WSS 3.0 Application Development)
President
Collaborative Innovations
-> Try Picture Attachments Wizard 2.0 For Microsoft Outlook <-
-> Take your SharePoint content offline <-
-> More info: http://www.collaborativeinnovations.ca <-
Blog: http://blogs.officezealot.com/legault Tag: WORD SpellCheck, Add to Dictionary button Tag: 115593
how do you automatically generate a letter on certain dates
bsd
I would like to automatically generate a birthday greeting letter in
word2000 to my friends a day before their birthdays wich I have a tendecy to
forget Tag: WORD SpellCheck, Add to Dictionary button Tag: 115591
copying each page of a dcument
Hello all,
Is there any way to copy each page of a document separately from the
header and footer?
In my code when I use:
Selection.Bookmarks("\page").Range.FormattedText
it selects both the text in the page and its header and footer. I want
to store the formatted text of a page and its header and footer in
separete files.
thanks
mona Tag: WORD SpellCheck, Add to Dictionary button Tag: 115590
Insert pics from folder
I am trying to create a template to automate the creation of a word document.
I already have the template prompting the user for name, date, etc. It also
prompts the user for a filename for this particular case. I am now trying to
prompt the user for a folder containing bitmap images for that case.
The document consists of two columns containing bitmap images. The problem
is one case my have 4 images and the next may have 20 images. I was going to
use bookmarks but because I don't know the number of images from one case to
the next I'm not sure that is the best way to handle it.
I would like the user to be prompted to select a directory and then the code
would determine the number of *.BMP files in that directory and insert 4
images in each column with a blank line between each image. In order to fit
within the column each images needs to be sized to 2.75" in width. When it
gets to the bottom of column two insert a new page and continue on.
Your suggestions are greatly welcome and appreciated.
Mainer Tag: WORD SpellCheck, Add to Dictionary button Tag: 115586
Problem with highlighting words
Hi,
I have a word document containing the following sentence.
All people in the city =96 big and small had arrived to watch the
marathon from start to finish
I am running the macro below (adapted from a post in this group) to
highlight the words in the vFindText array.
Sub HighlightWords()
Dim vFindText As Variant
Dim sReplText As String
Dim sHighlight As String
Dim i As Long
sHighlight =3D Options.DefaultHighlightColorIndex
Options.DefaultHighlightColorIndex =3D wdBrightGreen
vFindText =3D Array("big", "small", "start", "finish")
sReplText =3D ""
With Selection.Find
.Forward =3D True
.Wrap =3D wdFindContinue
.MatchWholeWord =3D True
.MatchWildcards =3D False
.MatchSoundsLike =3D False
.MatchAllWordForms =3D False
.Format =3D True
.MatchCase =3D False
For i =3D LBound(vFindText) To UBound(vFindText)
.Text =3D vFindText(i)
.Replacement.Text =3D sReplText
.Replacement.Highlight =3D True
.Execute Replace:=3DwdReplaceAll
Next i
End With
Options.DefaultHighlightColorIndex =3D sHighlight
End Sub
The problem: Only the words "big" and "finish" are getting highlighted
in green. The words "small" and "start" are not. What could be
problem?
Thanks in advance for the help.
Regards,
Raj Tag: WORD SpellCheck, Add to Dictionary button Tag: 115576
Question about memory allocation
Hi,
I defined A as an array in this way:
Dim A() as string
It is an array with unspecified array size.
Somewhere in the programme, I define the array size like this:
ReDim A(10)
When I redim, does it mean some memory is immediately allocated for
this array or does memory is allocated for this array ONLY when I
define the elements as well, like, for example,
ReDim A(10)
A(1)="apple"
A(2)="orange"
....
?
Thanks.
Mike Tag: WORD SpellCheck, Add to Dictionary button Tag: 115560
Word 2003/2007 Prompting to Save Document
Hello All. I posted this question last week. Got some suggestions from Doug
the MVP (Gracias for you efforts), but was unable to solve the problem. No
one else chimed in. Here's the deal.
We have an application that creates Word documents by automating
Word with VBA and mail merge. All is good, application works as it should,
creates the documents just fine and all. Problem is, when the user opens the
file with Word 2003 or 2007 and prints the document (they are protected, so
they can't change them), the document still prompts the user if they want to
save the document. Behaviour does not occur if the file is created with Word
2000 or Word XP, nor does it occur with documents not created in this manner.
Behavior continues with file indefinitely, where it will always prompt the
user to save the document upon close if the user prints the document. I've
posted an example of the document on our website:
http://www.databasewhiz.com/tmp/NAS/8000009_Demand Letter.doc
Clearly Word thinks something is changing when the user prints the file, but
what? I've included part of the Sub that generates the file:
Set wrdApp = CreateObject("Word.Application")
wrdApp.Documents.Open FileName:=strDoc, AddToRecentFiles:=False,
Visible:=True
With wrdApp.Documents(strDoc).MailMerge
.DataSource.FirstRecord = 1
.DataSource.LastRecord = 1
.Destination = wdSendToNewDocument
.Execute
End With
wrdApp.Documents.Item(1).Activate
wrdApp.Documents.Item(1).Protect wdAllowOnlyComments
wrdApp.Documents.Item(1).SaveAs "C:\access\NAS\" & intHmnrID & "_" &
strDocName
wrdApp.Documents.Item(1).Close
wrdApp.Documents(strDoc).Close SaveChanges:=wdDoNotSaveChanges
wrdApp.Quit
Set wrdApp = Nothing
Nightmare prompt is starting to cost us lots of time & money. If anybody has
a clue as to why this would occur and how to fix it, would really really
appreciate it.
Thanks In Advance,
RJ
Database Whiz Consulting Tag: WORD SpellCheck, Add to Dictionary button Tag: 115555
Create macro to replace logo
My company has a new logo and I need to replace it in hundreds of templates.
It currently resides in the same place in all templates in the footer within
a text box. I have recorded a macro, but I get an error when running it on
subsequent templates. I am using Word 2003. Thanks for any assistance. Tag: WORD SpellCheck, Add to Dictionary button Tag: 115554
Automating search/replace within a block
Hi,
At the end of a macro automating the search/replace within a block, how
do I answer no to the dialog box asking if I want to search the
remainder of the document? Recorder does not record my answer.
Sorry, it must be basic, but cannot find the answer.
thanks
--
John Doue Tag: WORD SpellCheck, Add to Dictionary button Tag: 115547
Formfield wdDateText
Hi, I'm having a problem adding a formfield in Word 2000. I'm adding a
textbox and want it to be formatted with the DateText setting. I want the
formatting to spell out the month day, year when the user enters the date.
I've been playing with the TextInput property, but must be missing
something. This is the code w/o TextInput property.
Set ffield = ActiveDocument.FormFields _
.Add(Range:=Selection.Range, Type:=wdFieldFormTextInput)
With ffield
.OwnStatus = True
.StatusText = "Type Prior Application Filing Date, xx/xx/xx"
End With
Thank you.
jbc Tag: WORD SpellCheck, Add to Dictionary button Tag: 115545
Visual Studio VSTO Projects wants Office 2003??
I just installed Visual Studio 2005 and VSTO. When I try to create a
Word Document project it complains that I don't have Office 2003
installed. I do have Office 2007 installed.
What's up with that? Tag: WORD SpellCheck, Add to Dictionary button Tag: 115541
Repopulate UserForm from Document
I have created a 2003 Word Template [2007 Compatibility Mode] that uses 2
userforms. (The 2 userforms are identical, except for the Name and some of
the VBA coding.)
The first userform loads when the template opens as a document to which the
user enters information in each field and upon clicking OK, the new document
populates with the entered information.
The second userform was created to appear with the help of a keyboard
shortcut macro to appear so that the user has the option of changing the
previously entered information.
My problem is that I want the second userform to populate with the
information that was previously entered. Here is a sampling of my code for
the second userform:
Private Sub DisplayEditForm1()
With ActiveDocument
txtProjectDescription =
ActiveDocument.Variables("ProjectDescription").Value
etcâ?¦..
End With
End Sub
I have tried some of the other posted suggestions, but I'm still having
problems.
Does anyone have any suggestions?
Thanks bunches!! Tag: WORD SpellCheck, Add to Dictionary button Tag: 115539
Using KeepTogether for paragraph formatting
Hi everyone,
Here is my scenario: I'm creating a MS Word document using the Interop/Word
API. My document consists of multiple "blocks" and I need to ensure that each
block does not overflow a page. I have found multiple references to the
KeepTogether property but have not been successful at getting it to work.
Currently I am treating a document as a collection of paragraphs. In my code,
whenever I encounter a new "block", I am creating a new paragraph. I then
pull the range from the paragraph object and write out to the document until
I detect the end of the block.
// New block...
Range.InsertAfter("some text");
Range.Collapse(ref end);
Range.InsertAfter("most text");
// say I detect end of block here
Range.InsertParagraphAfter();
// repeat from top
If I try to set the KeepTogether property of a given paragraph, I get a
"invalid value for range exception"...
I'm setting the property like so:
doc.Paragraph[1].KeepTogether = 1;
I can't figure out what it is I'm doing wrong here...
Thanks for any help! Tag: WORD SpellCheck, Add to Dictionary button Tag: 115537
Error! No document variable supplied.
Hi to all
I have developed a system in Delphi and want to print into Word some
information. I have created the field in Delphi that will print in word
(DOCVARIABLE varname, IF{DOCVARIABLE varname}=" " "" ) but I keep having the
message "Error! No document variable supplied." when no data is in Delphi
database field. It works when there is data. Can any one out there help me in
building the intructions to avoid the message mentioned above when the field
is blank?
Thanks for your valuable help.
--
CP Tag: WORD SpellCheck, Add to Dictionary button Tag: 115522
Header usage
Hi,
I`m not new to code but not an expert with office..is there a way to produce
a header only on certain pages?.What I am tring to do is insert our company
Logo into some batch processed documents. We do not want to use letterhead so
the best would be to insert the logo within the Doc itself. Trying to use
headers really isnt an option because every page will have the header and we
really dont want that.. I have thought of using a text box and embeedding the
image which makes sense but being that I need to do this in batches its hard
to do beacuse of the section breaks and so forth..
Would anyone have any ideas on how I could go about insert the logo once per
document, keeping in mind that the batch merges can draft many letters onto 1
doucment.
Hope that explains it enough..
thanks
R Tag: WORD SpellCheck, Add to Dictionary button Tag: 115521
Application.screenupdating = false?? What's going on?
Hi,
I have the following code:
Private Sub RadBtnCI_Click()
Dim otable As Table
For Each otable In ActiveDocument.Sections(4).Range.Tables
Application.ScreenUpdating = False
Call HideTableRows_fromRadioButtons(otable)
Application.ScreenUpdating = True
Next
RadBtnCI.Select
End Sub
The "HideTableRows_fromRadioButtons" subroutine unhides plenty of rows in
many tables and calls other subroutines. It takes 15-20 seconds to complete.
During this time, despite of the Application.ScreenUpdating = False, the
left side of the screen gets filled up with black horizontal lines.
Application.ScreenUpdating = False DOES prevent the screen from showing how
each table expands and collapses gradually, but I'd like to know whether it's
possible to get rid of these annoying black lines that might confuse the user
and led him to think that the computer is going to crash.
The black lines do dissappear when the subroutine is complete, but 20
seconds of black lines filling up the screen is annoying, unprofessional and
makes you think the program is crashing.
Any help is appreciated,
Thank you Tag: WORD SpellCheck, Add to Dictionary button Tag: 115510
Progress bar that tracks actual progress??
I just finished implementing and testing my first progress bar. I got the
code from this link:
word.mvps.org/faqs/Userforms/CreateAProgressBar.htm
I was dissappointed though!! As far as I understand how the progress bar
works and based on my timing results, the progress bar does not track actual
progress, it simply fills up a bar independently of the actual progress of a
subroutine. In the end, you get a slower program that does nothing to keep
the user informed of the actual progress.
Is there a way to code a real progress bar, one that actually tracks the
actual progress of a subroutine? Even if it does it with an error margin?
Thank you,
Juan Tag: WORD SpellCheck, Add to Dictionary button Tag: 115508
Use Saveas to convert document to PDF without prompting?
Is it possible to use Saveas to convert a Word document to PDF without
prompting?
I'm using Word 2007 (and Vista), and I have the line:
newDoc.SaveAs FileName:=sNewFileName, FileFormat:=wdExportFormatPDF
It worked, but I had to answer two promts for each PDF file saved. Is there
a way to accomplish this without prompting?
Steven Craig Miller Tag: WORD SpellCheck, Add to Dictionary button Tag: 115506
Forming a sentence from a checkbox list
Hiya - first post alert!
I'm try to get word to form a sentence from user selected checkboxes,
for example a user selects the items that they want and then word
forms a sentence such as "i want X, Y and Z" So that it inserts commas
and the word "and" in the correct place.
i tried having a count, for the items and then when the count is > 1
getting word to type ", " but this code never called.
any help please? Tag: WORD SpellCheck, Add to Dictionary button Tag: 115497
Re: How to get to email from Word
Hi,
I am referring to the thread "How to get to email from Word" dated
4/20/2008. Virtually you have made the formatting worked.
I'm using Word 2003/Outlook 2003. I copied the whole sub from Gramham's
final version dated 04/22/2008, but I am stuck with error 91 - object
variable or With block not set) on the statement
objDoc.Range.Paste.
What do I need to do get around with the this error?
Many thanks, Tag: WORD SpellCheck, Add to Dictionary button Tag: 115491
Convert Document object to byte array without using hard drive
I'd like to use MS Word as a text editor and store the data as a byte[]
within a name in Excel. I'd like to embed a Word document in an Excel file
so the user can create rich 'how-to' documentation which gets transported
with the workbook.
Document's SaveAs and Open methods require a filename to be passed in, and a
Document object is not serializable.
To save the file, I could save the Document as a temporary file as an
intermediary, and then open up that file as a FileStream which I could then
convert to a byte array. However, creating the FileStream doesn't work if
the Document is still open in Word as it is being used by another process.
Outlook seems to be able to use Word as a text editor for composing email
messages, I'd like to do something similar.
Any ideas? I'm using C# in VS 2008 Professional, and Office 2003. Thanks. Tag: WORD SpellCheck, Add to Dictionary button Tag: 115485
HELP PLEASE
My boss is very picky about how he wants this project manual done. Here are
his requests that I need assistance with:
1.) He wants the page #s to be on the right side on the front pages and the
page #s on the left side on the back of the same paper. How do I do this?
2.) He has each chapter broken up into separate word documents but he wants
the page numbers to change in all other chapters if he adds or subtracts
pages in other documents. Can this even be done? If so, how?
3.) How do you import all information from Adobe Acrobat to Word?
I am in a bind and he is expecting me to be some kind of expert. Please help
me.
--
LL Tag: WORD SpellCheck, Add to Dictionary button Tag: 115480
Insert sentence only if text field is not null
My searching is coming up empty, because I don't know what my intended result
is called. Can someone tell me the name of what I'm trying to do, and direct
me to the right reading? I want to insert some text if a certain field is
not null. I also want to insert the contents of that field in the
conditional text, i.e.:
...renew extensions of credit to the BKBORROWER[ and BKBORROWER2, each
singly or collectively].
Thanks in advance.
Sandi Tag: WORD SpellCheck, Add to Dictionary button Tag: 115473
Find and Replace all occurrences except the first
I have a find and replace vba script that can replace what I want, but it
does it to all occurrences, and the requirements are to replace all of the
occurrences except the very first one in the document.
The code is:
Sub FindAndReplacewithAcronym()
Selection.Find.ClearFormatting
With ThisDocument.Application.Selection.Find
.Text = "Full name of the item"
.Replacement.Text = "Acronym of the item"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
ThisDocument.Application.Selection.Find.Execute Replace:=wdReplaceAll
End Sub
How can I modify it to do this? Do I have to count the occurrences and then
do something while the count is greater than 1? Tag: WORD SpellCheck, Add to Dictionary button Tag: 115470
VBA scripting in Word 2003
I created a form using the web tools (I plan to add to company website). I am
having problems validating required user input. On a regular word form, I
validate the fields using ActiveDocument.FormField(FieldName). How would I do
this same thing on a form created with the web tools? Tag: WORD SpellCheck, Add to Dictionary button Tag: 115465
Code to recover passwords
Hi,
I am looking for a code to recover the password protection I put on a word
document, I can't remember the password and I need to alter the document, can
anyone help me please. i know you can run a vba in excel to recover the
passwords but dont know about word.
Regards Tag: WORD SpellCheck, Add to Dictionary button Tag: 115457
Templates - choosing a header/footer
I have created numerous templates all based upon 1 letterhead with the
company logo on top and address info in the footer.
I populate form fields from our host systems, select drop downs, check
boxes, etc upon doc new.
Recently our company started marketing new poducts within a new company. All
correspondece for this company uses a different header/footer, although
eveything else is the same (body of letter, form fields, etc).
Rather than creating templates for each company, I was thinking of having a
userform where the person could select which company. Based upon that info it
could load the appropriate header/footer.
I'll use Comp A and Comp B for example.
Thinking I could leave templates with Comp A header/footer.
Upon doc (new) a userform would ask which company.
If Comp A selected then no change.
If Comp B selected then would need to delete header/footer and insert new
header/footer.
By delteting and inserting header/footer, would that affect the body text,
form fields,etc?
Or is it easier to start with a blank doc and then show userform and then
insert the header/footer based upon choice?
Is this possible to do either of these and if so please offer suggestions on
how to go about this.
Or am I reaching and the best practice would be to use different templates
and just copy the letter body and macros?
Thanks,
Bryan Tag: WORD SpellCheck, Add to Dictionary button Tag: 115454
copy document to other document
Hi,
I have searched a few day's for the next problem.
I have several document in a directory.
With a simple form I would make one big document.
The form part is working, but I can't merge the documents together.
With the code below, I get only the result of the last document.
Public Sub copy_selection_from_file_2()
Dim docBron As Word.Document
Dim docOut As Word.Document
Dim rngIn As Word.Range
Dim rngOut As Word.Range
'
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron_1")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
Set docBron = Documents.Open("D:\Data Offline\Word
\copy_test_bron_2")
Set rngIn = docBron.Content
Set docOut = Documents.Open("D:\Data Offline\Word\copy_test_doel")
Set rngOut = docOut.Content
rngOut.FormattedText = rngIn.FormattedText
docBron.Close (wdSaveChanges)
docOut.Close (wdSaveChanges)
End Sub
somebody a hint how it could work?? Tag: WORD SpellCheck, Add to Dictionary button Tag: 115452
Word Macros and Merging
Hi
I've written a very simple find and replace macro, however when I merge a
document into the template, the macro runs BEFORE the merging (I tested this
with a msgbox that shows the macro has run beforehand). I am using "autonew"
for the macro at the moment but I really want it to wait until after the
merging to run.
Any ideas?
Thanks.
Matthew Tag: WORD SpellCheck, Add to Dictionary button Tag: 115449
Determining Font Colour
G'day!
I'm working on a little tool that presents key information about the styles
in a document in a more user-friendly format. One of the data points I want
to provide is the font colour. I've read heaps about changing the colour of
various things - bits of text, graphs, even fonts - but I haven't seen
anything about determining what the colour of a font is currently. If I use
the value of the .Color property of the Font object, it gives me _really_
useful things like: -16777216 for Automatic; 255 for Red; 16711680 for Blue;
etc. Unfortunately, I don't think too many of my users are going to
understand this. <g>
Is there an easy way to "translate" the .Color values into something that a
wetware-based system can make sense of? I'd be happy with just the wdColor
constants and show anything else as "Custom".
--
Cheers!
Gordon
Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup. Tag: WORD SpellCheck, Add to Dictionary button Tag: 115442
Extract form field data to Access
I have used Greg Maxey's "Extract Formfield Data" macro fairly extensively
and I think I almost have is just perfect.
I am trying to use an (If, Then, Else,). If the formfield has data than
write it, if not, than go to the next formfield and check it for data etc. I
have many many form fields so the code would be reputitious. The macro hangs
if there is not data in the field identified or if the field does not exist.
I need it to skip if no data ....... or ........ if that field doen't exist.
Here is a snap shot of the reputitious portion of the macro and where it
hangs. What do I need to complete the If, Else etc.
If .FormFields("ReviewTitle").Result <> "" Then _
vRecordSet("ReviewTitle") = .FormFields("ReviewTitle").Result
If .FormFields("FHWAUnitOffice").Result <> "" Then _
vRecordSet("FHWAUnitOffice") = .FormFields("FHWAUnitOffice").Result
If .FormFields("ReviewTeamLeader").Result <> "" Then _
vRecordSet("ReviewTeamLeader") = .FormFields("ReviewTeamLeader").Result
If .FormFields("ProgramCategory").Result <> "" Then _
vRecordSet("ProgramCategory") = .FormFields("ProgramCategory").Result
Thanks for your helpful comments in advance.
--
Eric the Rookie Tag: WORD SpellCheck, Add to Dictionary button Tag: 115439
VBA scripting for Web Tools
I have created a form in Word using the web tools (want to make it a web
form). When I try to validate in the required user input, I do not know how
to call the required fields. In a regular word form, I have been using
ActiveDocument.FieldForm(FieldName). Any ideas on what how to do that in a
web form? Tag: WORD SpellCheck, Add to Dictionary button Tag: 115437
Word 2007 Use buildingblocks from other templates
L.s,
I have a .dotm file with macro's, buidingblocks, changes in the UI, etc. I
placed this in the startup folder from word. When i start word all is
availible and works fine.
I placed it not in Normal.dotm fot each user, this is a read-only file wich
all users use so its easy to maintain.
I recorded a macro to place a buidingblock in the header. It says:
activedocument.atachedtemplate.buildingblocks("name")....
But when I run the macro from the UI I get a error.
I could replace atachedtemplate with something like temlates("name"). But I
like to keep the macro simple and without fixed filenames.
Is there a way to let the macro look in all the open templates (like it
works when I look for a buildingblock "by hand"), without programming all
sorts of loops. Something like "all-templates", "open-templates",
"active-templates"
Thanks
Peter Tag: WORD SpellCheck, Add to Dictionary button Tag: 115436
Autotext drop-down list
I need to create a document with drop-down lists but not use a form. I
thought I could create an "autotext" field but I am having trouble following
the Word Help or any of the tips here. I want the default field label to be
"List of Ratings" and then give the user a choice of five different
performance ratings to select from. Can anyone give me instructions or a
link to a site where someone has already documented it? TIA Tag: WORD SpellCheck, Add to Dictionary button Tag: 115434
Is it possible to prgrammatically, such as in a macro, disable the Add to
Dictionary button in WORD's Spell checker?