bookmark macro question
I have a VBA addin for word that will fill in multiple bookmarks in a
document. So, if i have bookmarks in a document bkName, bkName1, bkName2,
ect.......throughout the document the program will fill in the name in the
right spot. it simply looks for a new
My users are novices. i am trying to build them a toolbar to simplify the
process.
i have the toolbar built which includes a bunch of buttons using code like:
Sub bkName()
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="bkName"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
End Sub
I know the program uses the following code to loop thru filling in the
bookmarks
Private Sub SetBookmarkText(doc As Document, ByVal Name As String, ByVal
Value As String)
On Error Resume Next
With doc
.Bookmarks(Name).Range.Text = Value
Dim i As Integer
i = 1
Do While .Bookmarks.Exists(Name & CStr(i))
.Bookmarks(Name & CStr(i)).Range.Text = Value
i = i + 1
Loop
End With
End Sub
How would i modify the bookmark creation code to check for an existing
bookmark and LOOP thru to create them? So, if bkName is already in the
document it will insert a bookmark bkName1 and if bkName1 is already in it
will do bkName2
any direction would be appreciated.
thanks
JB Tag: table cells Tag: 90797
Cascading/Conditional Dropdowns
Hi All
I am new to this discussion group - thanks for providing it.
I have a situation similar to another user who wanted to programmatically
populate a dropdown based on the results of the previous dropdown. The user
was provided the following code:
Sub PopulateSubCat()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("Cat").Result
Case Is = "A"
With oFld("SubCat").DropDown
.ListEntries.Clear
.ListEntries.Add "Apples"
.ListEntries.Add "Apricots"
.Value = 1
End With
Case Is = "B"
With oFld("SubCat").DropDown
.ListEntries.Clear
.ListEntries.Add "Blueberries"
.ListEntries.Add "Bananas"
.Value = 1
End With
Case Is = "C"
'Etc.
End Select
End Sub
My situation is somewhat different however in that I need to
programmatically populate the first dropdown as well.
The first dd I need to populate is for group offices. Word limits the
entries in a dropdown (as I am sure you well know) to 25 and there are approx
30 group offices.
The second dropdown I want to populate is sales reps and I want to populate
the dd based on the selection in the group office dd. I also have a third dd
which will be account assistants which I would like populated based on the
group office selection as well.
For example, if the user selects Atalnta from the (programmatically
populated) Group Office dd, I want the Sales Rep dd and Account Assistants
dropdowns to populate with sales reps and account assistants in the Atanta
Group Office.
Also, I have a Cost Center field I would like to have populated with the
cost center of the group office selected in the first dropdown).
In other words, on selection of the group office I want the sales reps for
that group office to display in the Sales Reps dd, account assistants for
that group office to display in the Account Assistants dropdown and the cost
center for that group to appear in the Cost Center field.
Is it going to take a ton of code to accomplish this? Not that mind a
little work mind you and I love VBA (although I have never used it in Word)
but I am a little intimitated b/c my experience with VBA is in Access and
somewhat limited in that I use basically the same code over and over again in
different scenarios.
Anyway, any help with this woud be greatly appreciated.
Oh, sorry for the long post - I just wanted to make sure I was clear on what
I want to do.
btw: I believe it is Office 2000 I am using at work (I just started 3 weeks
ago so I am not 100% sure but I believe it is 2k)
Thanks so much
Dattagal Tag: table cells Tag: 90786
Word 2003 Find/Replace Doesn't Ignore Deleted Text
I'm trying to write a macro that finds & replaces several things all in one
batch. Track changes needs to be on.
The problem is that the "finds" also see and act on deleted text. How can I
run a find and replace that ignores the deleted text? I know this was a
problem in Word 97 because I found a KB article on it. Surely they fixed it
by now?
I have tried limiting finds for black text or font style normal...that
doesn't work. Tag: table cells Tag: 90776
using checkbox to delete a section of text
I have a template that has 20 sections that I use daily and need to be able
to delete different sections each time. I am not sure what the best way
would be to set it up but I think that I would like to have a UserForm come
up when the document is opened that would list all of the sections with check
boxes by each. Then I could select the check boxes that go with each section
that I want to keep and then when I exit the user form all of the unchecked
items are deleted.
I am open to different suggestions if there is an easier way.
thanks alot for the help. Tag: table cells Tag: 90775
IF statement with empty text field won't work
I'm working on a document and want this to happen:
Document asks "Username?" using the ASK field.
If something is typed in, i want it to display Username: and then the
persons username, but if nothing is typed in the box, i want it not to show
anything, not even the "Username:" label. Word is seeming to have trouble
with the 'nothing' part of this. Here is what i've tried which hasnt seemed
to work:
{ ASK user "Username:" }
{ IF user = "" " " "Username:{user}" }
Any help will be much apreciated! Tag: table cells Tag: 90772
Transferring autotext
I need a way to transfer AutoText between two normal.dot templates. I'm
guessing this might be possible with VBA. Any suggestions as to how to
reference the autotext object?
Preferably the solution should also work for older versions of Word.
Note this refers to autotext, NOT autocorrect entries. (often a source of
confusion!)
-------------------------------
An alternative approach to XP network logon - http://mylogon.net Tag: table cells Tag: 90765
Removing specific characters when preceded by one or more spaces
Hi: I want to remove the forward slash from a document if and only if it is
preceded by one or more spaces. i.e. â??abc/â?? is OK but â?? /â?? or â?? /â?? or â??
/abcâ??â?¦ is not. The following code successfully removes the forward slash
character that is preceded by a single space from a document and replaces it
with a highlighted space. So if there are 2 or moreâ?¦spaces before the forward
slash, I want it to be removed and replaced with a highlighted space. (I am
fine with all the spaces being removed and simply replacing the entire string
with a single space.) What do I need to do to modify the code to accomplish
such? Any help is greatly appreciated.
'Removes / proceeded by a single space and replaces with a highlighted space
Dim rDcmForwardSlash As Range
Set rDcmForwardSlash = ActiveDocument.Range
With rDcmForwardSlash.Find
.Text = " /"
.Replacement.Highlight = True
.Replacement.Text = " "
.MatchWildcards = False
.Execute Replace:=wdReplaceAll
End With Tag: table cells Tag: 90764
open a list of check boxes
I use the same document on a regular basis but have to select specific
paragraphs to delete each time. I have created a macro to delete each
paragraph but would like to have a form that pops up when the template is
opened that has a check box for the paragraphs that I would like to keep in
the final document.
Thanks for all of the help. Tag: table cells Tag: 90759
copy menu bar
Is there anyone know how to copy menu bar from a template to another word
document that's not created by the template?
I created a menubar in a word template and would like to copy it to other
word doc as well. The only thing that I can do is copying its macro to
normal.dot which would be applied to all word docs but it doesn't copy the
menubar as well.
Thanks in advance! Tag: table cells Tag: 90751
Macro in Word: Switching between two documents
Word 2003: I want to build a macro using my key board keys. (Alt/z).
I want to loop my macro with hitting the "Alt/z" keys once.
Taking text from document 1 -- I will tell me macro to look for a particular
character in document 1 and placing the text into document 2.
I'm looking for the macro to go throught the entire document until it reach
the end of the document. Tag: table cells Tag: 90750
replace manual page breaks
Is it possible to programmatically replace all manual page breaks in a
document with Next Page Section Breaks?
Thanks.
--
tj Tag: table cells Tag: 90738
Counting References/paragraphs of a given style??
We currently have a macro to loop through a document and cound "references"
which are marked with a specifc style so that we can find them. The issue
is that this code seems to be hanging Word and not sure why. Does anyone
have any ideas on what the issue is or a better way to handle this?
With ActiveDocument.Range.Find
.Style = "My Reference"
While .Execute
l = l + 1
If l > ActiveDocument.Range.Paragraphs.Count Then
GoTo endloop
End If
Wend
End With
endloop:
ActiveDocument.CustomDocumentProperties("RefCount") = l Tag: table cells Tag: 90730
wdUserOptionsPath
hello,
we have special made templates for word 2000 now i want to migrate to word
2003. in word 2000 there was a wduseroptionspath, you can find this option
under filelocations in word 2003 this is not a option anymore. Now i have
problem because the templates are looking for info but the location isn't
there anymore. I don't wont to change the whole code.
So does anybody now where i can change the location for wdUserOptionsPath???
Greetingz. Tag: table cells Tag: 90722
Low performance when extracting data
I have written a macro to extract data from the active document. The macro
should be a part of an algorithm to auto detect headings. The problem is that
I get very long delays when accessing the DOM.
A code-snippet that show this behavior:
Dim nCount as Long
Dim oSents as Sentences
Dim sText as String
Set oSents = ActiveDocument.Sentences
if not oSent is nothing then
nCount = oSents.Count
if nCount > 1 then
sText = oSent.Item(nCount - 1).Text
endif
endif
For certain documents the Sentences::Count will take approx. 10s to execute.
Range::Text takes also approx 10 s to execute. The document is quite simple
with a TOC (~300 items), body text and a lot of heading. The document has 123
pages. I a would try to iterate through all sentences in this document it
would have taken to long time to be acceptable.
However, if I remove the table of content, then the execution time will be
below 1 s. Could someone explain why and is there any settings in Word that I
could modify to get rid of this problem? I have tried to run Word in safe
mode and also protected the document for editing with no performance
differences.
I am running Word 2003 and Win XP SP 2. My computer does not lack in
performance.
Jonas Tag: table cells Tag: 90717
Button on page to run macro
Having transferred a module containing a series of subroutines from 'Normal'
to a Word document I want others to be able to run two of the subs from that
document since they will not understand how to transfer the module to their
Normal file.
Question
How can I assign a macro to an object on the page which the user can click
to run the macro? In XL that's simple but in Word I cannot see how to do it.
Francis Hookham Tag: table cells Tag: 90712
Automatic printing in background using different printers
Hello,
i got a serious problem using automatic printing...
with several scheduled vbs tasks i start different word - documents,
containing vba. Each document prints out on a different printer.
Sometimes those documents are started at the same time which results in
printer confusion.
first document chooses "ActivePrinter= xyz" while the other document
chooses an other one. Now the first doc is printed on wrong location or
a dialogue states me to put in save as prn file...
Is there any way to tell word not to change the printer for the whole
windows environment but only for the started application?
I tried out a lot, but Application.ActivePrinter= "someprinter" results
in changing the standard printer of windows.
I do appreciate a lot your help, thanks!
Daniel Tag: table cells Tag: 90711
MS Word question
The residental inspector that I used did his reports in Word and had a
feature that would automatically type a sentence based on a few typed
keywords. Ex. " good shingle roof" would automatically insert a sentence
like "The roof is composition shingle and is in good condition with no
visible defects." Can someone tell me how to create this?
Thanks. Tag: table cells Tag: 90707
Mail merge Datasource Will Not Change Records
I am writing a vba app to automate a mail merge document. The doc is
connected to an access database. The datasource retrieves the data just
fine. Then I set all of the records include flags to false (thus excluding
them from the merge). Next I iterate through the list to include ones that
meet a criteria that the user has selected from a userform. If the criteria
is met, a function is called that sets the activerecord to the first record
(wdFirstRecord, I think). Then I use the find method to point the
activerecord to the correct record, and finally set the included property to
true. The problem is that neither the .activerecord = wdFirstRecord, nor the
Find method changes the record position, it remains at 1. Nothing I've tried
and nowhere I've looked has said anything about the records not being able to
move. Is there something in the connection string that can cause this, or
some property I'm not setting correctly?
There are more records in the set than just one, so that's not the problem.
Any help would be appreciated. Tag: table cells Tag: 90698
Converting Word 2002 macros
When trying to open a project in the Word VBA screen I get an error that says:
Title:Project Locked
Message: Project Unviewable.
How do I open it?
The template was loaded at startup and I can run the macros, but I can not
edit them.
Thanks.
matt R Tag: table cells Tag: 90695
Shading/Highlighting
I'm interested in having certain pieces of text highlighted or shaded on the
screen but not when printed. What's the easiest way to accomplish this? Tag: table cells Tag: 90687
get section name
I need to find a section number and get its name to store it in a variable.
Example:
1.1 Introduction
Need to find 1.1 and then store"introduction" into a variable.
Anyone know how to do that?
Thanks! Tag: table cells Tag: 90683
.Activate method not working
One of my users recently upgraded to Word 2003, and the
Documents(index).Activate method does not seem to be working on their
computer. Though it works on other users' computers, those with Word 2003
and Word 2000...
When the .Activate method is used on this user's computer, the selected
document is brought to the front of the window order, but the ActiveDocument
does not change. The ActiveDocument object continues to point to whatever
was the active document before the .Activate command was used.
Anyone know what could be causing this? Or should I just get to work on
eliminating the .Activate command from my code?
Thanks Tag: table cells Tag: 90681
Simple(?) calculation question
I have a EXCEL spreadsheet from one of our clients that I need to convert to
a form in Word, but I'm having trouble converting one of their calcluations.
In Excel the formula is =O95*(1-P95)
That's it. Cell O95 contains a dollar amount ($672)
and cell P95 contains a percentage (7.8%)
The answer in Excel is $620
No matter how I set this calcuation up in Word in the form field, I can't
get the same answer...not even close.
The field with the original number ($672) is named ModifiedPremium and I've
tried
=(ModifiedPremium)*7.8
=(ModifiedPremium)*(1-7.8)
=(ModifiedPremium)*(1-(7.8))
Etc...
Anyone know how this calculation SHOULD look? Thanks. Tag: table cells Tag: 90680
normal.dot in Office 2000 not working in Office 2003
I have been using a normal.dot in Office 2000 that is used on the new users
machines when they are set-up. When I tried to use this normal.dot on the
new user machines that are running Office 2003 it is not being accepted.
This normal.dot has all the macros, set-up and automatic text in it. These
new users are not being able to use these items when they open Word. They
have the default font and default information without any of the customized
information that is included in the normal.dot I have been giving them. I
really nead to be able to find out how to use this customized normal.dot. I
hope that someone has some information for me. Thanks in advance. Tag: table cells Tag: 90676
Markup View in Word 2003 - Need code to turn it off if it's on
Hi, Everyone:
I'm trying to find a way to turn off View, Markup that I can add to the code
that's executed with my templates. I found the following in another
message/thread, but I don't think this will work for me.
........
ActiveDocument.TrackRevisions returns a Boolean True if Track Revisions is
turned on.
You can turn it on using:
ActiveDocument.TrackRevisions = True
or off with:
ActiveDocument.TrackRevisions = False
-------
I don't want to make it stop "tracking" changes since the users may need it.
I just don't want it EVER to DEFAULT to viewing them (which it has been -
OFTEN - it's driving me crazy). When I tried recording a macro while turning
off Markup View, all I got was the following line:
WordBasic.ViewChanges
..which seems to be telling it to turn Markup View ON instead of OFF (which
tells me that it's probably just a toggle switch. Is there a way to check to
see if it's already in Markup View before doing the toggle (using an if
statement), like this?
If (some code to check for Markup View, NOT document tracking) = True then
WordBasic.ViewChanges
End if
Does anyone have any suggestions?
Thanks in advance,
Peg
--
Message posted via http://www.officekb.com Tag: table cells Tag: 90675
Select text with macro based on criteria
Hi,
I am a newbie trying to self teach VB. I am pretty useless so please be
gentle.
I am trying to write a macro to allow me to select text in MS Word based
upon its case. I want to select all the text in the document that is in all
caps. Is this possible?
Also, is it possible to exclude 34 specific two letter strings of text? The
reason for this that specific "class codes" need to appear in in caps.
Can anyone help? As i said, i am pretty useless at this stage, so sample
code would be awsome.
Josha Tag: table cells Tag: 90655
All caps to Proper caps
Hi
I need to create a macro that will start at the begining of a Word document
and select all sections of text that are in ALLCAPS. It then must change the
instances of all caps to title or proper caps. However there are specific two
letter codes that must remain as all caps. Is this possible?
Basically, a mail merge that uses a database query as the datasource is
importing address and name details in allcaps. To maintain professionalism,
it is desired that these items are in proper caps. However, the letter
contains two letter 'class codes' that must remain in all caps (eg. BI, FH,
LF, NM).
I am only just learning VB and can only get the macro the select the whole
document and change it to proper caps. Manually selecting the required text
is not an option because the merge contains many records. This would take too
long.
My other thought was to use a macro to select specific line/column reference
to select the required text, then change it to proper caps, then repeat for
each page. I dont know how to do this either and it is not ideal as the
template letter may change, invalidating the references.
Any help would be much appreciated. I am *very* new to VB, so sample code
would be great.
Josha
-------------------------------------------------------------------------------- Tag: table cells Tag: 90654
Spell check fields from a data base
We have a custom data base application that merges with Word 2000 to produce
documents. The documents contain fields that are populated from the databse
and converted to text when the data and documents are meged together. Once a
document is produced, the Word spellcheck will not check any text that has
come from the fields in the database. I have set up a macro to run when the
documents merge to try and rectify the spellcheck problem, however this only
results in the spellcheck checking the first incorrect word and then stating
that the spellcheck is complete even though we know there are further
mispelled words in the document.
The code for the macro is as follows:
Selection.WholeStory
Selection.LanguageID = wdEnglishAUS
Selection.NoProofing = False
Application.CheckLanguage = True
After the document merges, the macro runs automatically and then we run the
spellcheck manually with the result that only the first mispelled word is
checked.
Any suggestions?
thanks, Tag: table cells Tag: 90653
This dosn't work with multiple selection
Sub ShowSelection()
Dim strText As String
strText = Selection.Text
MsgBox strText
End SubThis just shows the latest selected text.What I have to do to get
multiple selection? Tag: table cells Tag: 90651
read the whole section
EXAMPLE:
1 Scope of Test
This test case specification covers the test criteria necessary to ensure
that the Central Management Console functionality is working correctly.
In particular; the test cases are focused on object testing the following
tasks; though; testing of Server Management and User Management features
are not in the scope of this document.
OLAP related testing is not covered in this document
2 Assumptions and Constraints
The tester has familiarity with most of the functionality of Business
Objects Enterprise.
Hi,
I'd like to read whole section content. Like for example above, I'd like to
read the section content of "1 Scope of Test" which contain "This test case
specification cover.... until
OLAP related testing is not covered in this document" Afterwards, just save
it in a variable.
Is there anyone know how to do it?
Thankyou so much for your help before! Tag: table cells Tag: 90642
Multiple Templates & populate same info on each new document & Pri
Hi,
I have a few Word Templates that when each one is opened it takes the user
to a multiple pages of user forms to collect information from the user. Now
I want to use the same Templates in a single documents by suppressing the
NewAuto macro from execution and only populate the minimum amount of
information that I have collected from a single page of User form "say 2
fields of First name and Last name only" and populate these two fields that
are defined on each one of these Templates into each document and print that
document with just those two fields that I have collected and leave the rest
of the fields blank and go to do the same thing on the next Template new
document.
I assume that on the first New Template I need to collect these two fields
thru a user form then use these two fields open each Template as a new
document while suppressing the NewAuto macro populate these two collected
fields into corresponding fields then print and close the document and open
the next Template as new document and â?¦.
I think I need a new module Macro to do this for each Template and somehow
execute that new macro for that Template new document to do all I want to do.
How am I going to open each Template with what kind of switches and how to
all these I am not sure that I could do all that or if it is possibleâ?¦?
Thatâ??s why I posted this to get your help! Any suggestion is welcomed.
--
Jeff B Paarsa Tag: table cells Tag: 90640
read first character(number) in a word
Hi,
I'd like to read the first character in a word(number actually).
For example:
I have a number 1.1.2, I only want to read the first number which is 1 and
save it in a variable. If it's 3.2.3 then the first character will be 3 and
save it in a variable.
Please help me!
Thank you. Tag: table cells Tag: 90639
Active X controls changing names
I have been having this issue randomly for the last year with a set of Word
status reports that we created. With no pattern, the controls will just
rename themselves to default control names (like commandbutton1). This
causes all of the VBA code behind the document to stop working obviously.
What's even weirder is that the control no longer behave normally, but behave
as if they were in design mode. I saw a while back on this newsgroup that it
was recommended to change the names of the controls from the default given.
However, all of the controls on my documents already have custom names.
There are quite a few controls on the document (20+), and up until now we
have just considered this a bug with Word. Hopefully someone out there can
give me some advice though. Thank you in advance! Tag: table cells Tag: 90637
Macro to Save Filename
Creating a macro to modify a document, then save the document with the same
filename in a different directory. While creating the macro, i do a "File,
Save As" and select the location, but cannot get the open file name. Tag: table cells Tag: 90636
Cannot use Items function in several Word classes from C# in Word
I have a C# .NET program that links to Word via a reference to MSWORD.OLB.
After I upgraded to Office 2003, I get compiler errors on
Word.Tables.Item(), Word.Columns.Item(), and Word.Templates.Item().
When I try the same code in Word VBA, it works.
Any ideas why this is suddenly unacceptable.
Phil Tag: table cells Tag: 90634
UserForms and MultiPage Control
With lots of help from this site I have managed to create a UserForm and
successfully transfer information into a document. However, my document
requires quite a lot of input information and I'm considering how to handle
this.
The information can be grouped into 4 'sets' of data and I'm not sure
whether to use the Multipage control on a user form or to have several
independent forms that are triggered by selecting buttons on a custom toolbar.
Does anyone have any suggestions or can you point me towards any sites where
I can get more info on using the Multipage control?
Many thanks,
Sam Tag: table cells Tag: 90629
Replace Styles Macro - Endless Loop
Hi Everyone,
A couple of years ago, with much help from this group, I got a cool
macro that would go through a document and replace specific styles with
a different specific style. It worked great in Word 2000.
We have recently moved to Word 2003, and when I run the macro, it gets
stuck in an infinite loop if one of the styles specified in the "Find
Style" array does not exist in that particular document.
I'm sure it's a simple fix, but I'm not sure what I need to change.
It's been a couple of years since I've done any macro work, so I've
pretty much forgotten everything I learned.
Any help would be greatly appreciated!
---
Dim FindStyle As Variant, ReplaceStyle As Variant, k As Integer
FindStyle = Array("Style1", "Style2", "Style3", "Style4", "Style5")
ReplaceStyle = Array("Heading 2", "Heading 3", "Heading 4", "Heading
5", "Body Text1")
On Error Resume Next
With ActiveDocument.Range.Find
For k = LBound(FindStyle) To UBound(FindStyle)
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Format = True
.Style = FindStyle(k)
.Replacement.Style = ReplaceStyle(k)
Do While .Execute(Replace:=wdReplaceAll)
Loop
Next
End With
End Sub Tag: table cells Tag: 90626
Reverse decimal figures
hello everyone
I'm using the following code to reverse numerical figures in a word document.
The problem is when it encounters a decimal figure such as 71.6 it would not
reverse. I want all numerical characters to be reversed. So 71.6 should come
out as 6.17.
code:
Sub Aburaa()
Dim myText As Range
Dim myFinalWord As String
Dim aWord As Variant
Set myText = ActiveDocument.Range(Start:=Selection.Start,
End:=Selection.End)
For Each aWord In myText.Words
If IsNumeric(aWord) Then
myFinalWord = StrReverse(aWord)
With Selection.Find
.Text = aWord
.Replacement.Text = myFinalWord
.Format = False
.MatchCase = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
'MsgBox (myFinalWord)
End If
Next aWord
End Sub
Any help would be appreciated.
thanx
ahmed Tag: table cells Tag: 90623
how to void replace words in text formfields
I am trying to write a macro to replace a word from a template but not in
text formields.
For example, I have a checkbox, and put a description next to this check box
as "Excellent". now I want to run the macro to replace "Excellent" with the
word "Good". but meanwhile, user could possible type in many times of
"Excellent" word in different text formfileds. when i run the macro, i don't
want to replace these "Excellent".
Thanks for any help. Tag: table cells Tag: 90622
Formatting Autotext
I am using Officed 97.
I have created an autotext entry from a document by highlighting and adding
an autotext entry in a template, the formatting of the document is fine when
it is put into the autotext.
If I call the autotext in the normal manner it returns in the correct
format, but when I call this autotext from the following code, it loses a lot
of its formatting. Is there a way with code to prevent this please?
ActiveDocument.AttachedTemplate.AutoTextEntries("192general").Insert
Where:=Selection.Range
If so, would someone be kind enough to supply me with the code.
--
Mark Tag: table cells Tag: 90615
Creating a table at the end of a document and populating with data
Hello everyone,
Could some kind soul please offer me some starting code for the above?
I'd be in Access.
I'd be using a document variable such as WordDoc
I do a mail merge then have a document sitting there and now they want a
Schedule in table form at the end.
So what i'm looking to do is to add a table with probably a set number of
columns, say 4 or 5, and then start to fill out the table with data from
the database.
So i'd need to see how to create the table at the end of the document and
then how to access the fields so that I could insert the appropriate data.
oh yes, would only know the number of rows required after running query.
Thank you for reading... Tag: table cells Tag: 90606
can not do track change from outlook attachment, why?
the track change option from an attachment in outlook is grayed out, tried
saving it to desktop, but when opened it up in word still it is grayed out.
should i just copy and paste the doc into a new word doc, or there is another
way?
and also, why would this option be blocked on the attachment?
thank you Tag: table cells Tag: 90603
delete blank line
Hi,
I have 3 paragraphs in a table cell. Each paragraph separated by a blank
line. I'd like to delete the blank line so that all paragraphs aren't
separated anymore.
Example:
line1 sentences paragraph
line2 sentences paragraph
line3 sentences paragraph
Wanted:
line1 sentences paragraph
line2 sentences paragraph
line3 sentences paragraph
Code so far:
For tblIdx = 1 To ActiveDocument.Tables.Count
Set theTable = ActiveDocument.Tables(tblIdx)
If Mid(theTable.Cell(2, 2).Range.Text, 1, 23) = "Scenario and
Conditions" Then
With Selection.Find
.Text = "^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End If
Next
Would anyone know how to delete the blank lines in all of table cells?
Please help me! Thank you so muchh...
John Tag: table cells Tag: 90598
VBA code to execute for a subsequent mail merge
Hello, All!
My outlook 2k3 contact form is the default. The contact names take the form
of Full Name made up of First Name and Last name. First name for a husband
and wife is of the form "Jack & Jill". I need, in a mail merge to be able to
separate this field into two fields if the & exists in the First_Name field.
I was hoping I could do in using Word's IF...Then... Else but I can't.
While I normally create my mailmerge using the OL Tool|Mail Merge wizard,
that is not necessary since I have my document designed and simply need the
data exported. Is there a way with a macro in OL to export Contacts in a
form that would be usable by Word's mailmerge, but as it does so to do the
following:
1. Check the OL First_Name field.
2. If there is a "&" in the field place the second name in the Spouse field
and drop the "&" and following and put the remaining name in the First_Name
field of the merge data file.
3. If there is not a "&" in the First_Name field then do not modify the
field.
I could then reconstruct the couples with the IF statement in Word, but I
would have the couples names in separate fields to be able to use them in
other conditional command I want to use.
Thanks,
Colonel Blip.
E-mail: colonelblip.no.spam.please@bigfoot.com Tag: table cells Tag: 90590
Finding data in an Excel file
Hi,
I'm trying to find data quickly in an Excel file from a Word userform.
I currently have it working but it is very slow and am exploring faster
methods. Currently I have the macro going to a specific cell, and then doing
a loop downwards until it finds the correct string. I would prefer to use
either:
- the Find method on a range but can't seem to use the Cells.Find method in
Word
- or the Match Worksheetfunction but can't seem to specify the range (the
documentation I found on this topic identifies a need to set the range as an
object...I did this but it's currently not being recognized by Word). I am
currently getting a 'type mismatch' error on the line below. I suspect the
error is caused by the fact that the range is an Excel range, not one in Word:
myRange = .Application.Worksheets("Sheet1").Range("k1:m300")
Here is the code from beginning to end:
Dim test, results, answer
test = "CR 03"
Dim myRange As Range
Dim SalaryFile As Object
Set SalaryFile = GetObject("c:\Project\Pay Rate table v3.xls")
SalaryFileName = "CRA Pay Rate table v3.xls"
'*************OPEN EXCEL****************
With SalaryFile
.Application.Visible = True
.Parent.Windows(SalaryFileName).Visible = True
myRange = .Application.Worksheets("Sheet1").Range("k1:m300")
answer = .Application.WorksheetFunction.Match(test, myRange)
.Save
.Close
End With
MsgBox answer
End Sub
Would really appreciate some help here!
Thanks,
jille Tag: table cells Tag: 90584
Autofilling Pre-Determined Text into Selected Table Cells by a Macro
Hello,
I have a simple idea, which I'm hoping someone can help me with.
I have a table with several rows and columns. I would like to be able
to select a cell or multiple cells and have a macro:
(1) Delete the contents of the cell(s).
(2) Autofill the selected cell(s) with a specific, formatted text
(e.g. "TEST").
If anyone can help me, I would be so appreciative!
Thanks,
Roy Tag: table cells Tag: 90576
I have a document with 1 table composed by2 columns.
How can i write to take all the context for example of the
tables(1).cell(index,2) ?
Sub test400()
Dim sTmp As String
sTmp = ActiveDocument.Tables(1).Cell(1, 1).Range.Text
sTmp = Left(sTmp, Len(sTmp) - 2)
' cut off end of cell mark
MsgBox sTmp
End Sub