Event notification for Document evennts.. Very Urgent Pls Help
Hi All,
In my application, (i am using C and C++) i want to get notified when any
event occurs in a document which is opened programatically. I found som
earticles and help in Microsoft web site and i am able to recieve
notifications for the application object like, DocumentChanged() and Quit
with DISPIDs 2 and 3 respectively. For this, i used the Connection point
mechanism and i registered to get notified for the events for IID =
{0x000209f7,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 } } but
not i am not able to understand how to get notifications when user saves the
ducument or user closes the document without saving and things like that. If
i have to use some other IID for the same, please help me out. Or if i have
to check some parameter when i recive application even DocumentChanged(),
please do suggest.
In any case, please post your suggestions/may be with piece of code to me .
Thanks in advance.
Regards,
-Basavaraj Tag: how to create unicode text dictionary Tag: 61415
Help with Document Objects and other general questions
Hi,
I am trying to create a macro that will count the occurrence of a list of
Words. The list of words is in a two column document with the words listed
in column 1. The macro compares each word in column 1 with each word in the
document and records the number of matches in column 2.
What I have posted below works (seems to), but I am not clear on the use of
document objects. Basically I have the document open and then open the word
list to create the array. Once the array is created I switch back to the
document (why do I have to use documents(2).activate). It seems I should be
using documents(1) since it was the orginal open document and appears in the
Window menu as #1. Please explain this.
I sense that what I have created in grossly inefficient and want to believe
that there is a better way than doing a word by word comparison for each
word in the list. I toyed with the idea of finding and replacing the words
with themselves but couldn't figure out out to get a count. Ideas?
Thanks.
Sub WordFrequency()
Dim ListArray
Dim i As Long
Dim j As Long
Dim k As Long
'Open and build and array of words to count
Set WordList = Documents.Open(FileName:="D:\My Documents\Word\Word
Documents\Word Tips\Macros\Word List.doc")
ListArray = WordList.Tables(1).Range.Text
ListArray = Split(ListArray, Chr(13) & Chr(7))
'Active the orginal document (don't know why this is 2 rather that 1)
Documents(2).Activate
'need this starting k value later on
k = 2
'compare each word in the list with the words in the doc
'count if match occurs
For i = LBound(ListArray) + 3 To UBound(ListArray) - 1 Step 3
j = 0
Selection.HomeKey Unit:=wdStory
System.Cursor = wdCursorWait
For Each aword In ActiveDocument.Words
If Trim(LCase(aword)) Like ListArray(i) Then
j = j + 1
End If
Next
'switch to the word list
Documents(1).Activate
'record the count
ActiveDocument.Tables(1).Cell(k, 2).Range.Text = j
k = k + 1
'switch back to the orginal document
Documents(2).Activate
Next
End Sub
--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support Tag: how to create unicode text dictionary Tag: 61414
Unsaved changes in the Normal template
Due to sloppily written 3rd party apps/add-ins/macros, many users are
troubled by the message asking whether they want to save changes to the
Normal template.
In many/most cases, one has to know how to examine VBA code to determine the
cause of such changes.
I was thinking of doing the following in a class, but I'm not sure whether
this would help or further annoy users.
I would include code that checked for a dirty Normal template at class
startup AND before each macro runs.
I would issue a message asking whether the user wanted the macro to save the
changes now, and also give the user an opportunity to cancel the macro. The
choices would be Yes, No, Cancel.
Is the above useful?
In any case, I will include code that checks for changes in Normal when the
class terminates.
This is to assure that my code does not cause any unintentional changes in
the Normal template.
--
http://www.standards.com/; See Howard Kaikow's web site. Tag: how to create unicode text dictionary Tag: 61412
Macro causes Word to freeze
This is a macro I use frequently to count the number of occurences of a
word in a document. It's very fast and convenient. I simply place the
cursor in the word, and run the macro, and it gives me a message box
with the result
But it frequently causes Word to freeze up. Can anyone point to what
may be wrong with it?
Thanks,
Larry
Sub TextCountQuick()
' Counts current word or selected word or string.
Dim myrange As Range
Dim myPhrase As String
Dim i As Long
' Clear Find parameters
With Selection.Find
.Replacement.Text = "": .Format = False: .MatchCase = False
.MatchWholeWord = False: .MatchWildcards = False: .MatchSoundsLike =
False
.MatchAllWordForms = False: .ClearFormatting
End With
Application.ScreenUpdating = False
System.Cursor = wdCursorWait
Set myrange = ActiveDocument.Range
' If there is no selection, select current word.
If Selection.Type <> wdSelectionNormal Then Selection.Words(1).Select
' Unselect any empty space after text.
Selection.MoveEndWhile cset:=" ", Count:=wdBackward
myPhrase = Selection.Text
Selection.Collapse wdCollapseStart
myrange.Find.ClearFormatting
myrange.Find.Replacement.ClearFormatting
With myrange.Find
.Text = myPhrase
.Forward = True
.MatchWholeWord = False
.MatchWildcards = False
' Strange. If I have wdFindContinue, the macro goes into an endless
loop.
' So I've commented this out. This must have to do with fact that I'm
using
' document range rather than selection.
' .Wrap = wdFindContinue
Do While .Execute
i = i + 1
Loop
End With
MsgBox "Occurrences of '" & myPhrase & "' " & i, , "Text Count"
' clear Find parameter
myrange.Find.Text = ""
End Sub Tag: how to create unicode text dictionary Tag: 61409
microsoft word
I accidently deleted my microsoft word and i cant seem to find a download to
get it back. The version of windows I am using is windows XP. Can you
possibly give me a direct link to download one? Tag: how to create unicode text dictionary Tag: 61405
saveas method
Hey all,
This could be an easy question but I can't seem to solve it yet.
In my VB program, I am making a reference to the Office Library to use the
Excel methods. Everything works fine and I save the file using
Workbook.SaveAs TheFileName
This statement brings up the confirmation box if the file already exists.
However, I do not want it do that and just overwrite the file, if it already
exists. How do I do this? I do not want to delete the file before running
this because, sometimes, I have to add a new worksheet to an existing file
and cannot delete the old worksheets.
Thanks for your time / any response.
Vince Tag: how to create unicode text dictionary Tag: 61400
Which variable to represent a listbox?
I would like to use a procedure again and again for several listboxes in
a user form.
Therefore, I need to use a variable that can represent the various list
boxes.
Which variable type should I use?
=========================
Private Sub userform_initiate()
Dim oLBox As Object 'Object type DOES NOT WORK
End Sub
-------------------------
Private Sub butBrowse01_click() 'Browse button 01 next to list box 01
oLBox = ThisUserForm.ListBox_01
SelectFiles (False) 'AllowMultiSelect = false
End Sub
-------------------------
Private Sub SelectFiles(bMultSel As Boolean)
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
With fd
.AllowMultiSelect = bMultSel
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
oLBox.AddItem (vrtSelectedItem) '???
Next
Else
End If
End With
Set fd = Nothing
End Sub
=========================
ANDy Tag: how to create unicode text dictionary Tag: 61397
why does it not show me a new page when i double click?
I downloaded microsoft office word viewer 2003 however when i double click it
to launch it i get a window that asks me to type in the File. You normally
get a white page to type Tag: how to create unicode text dictionary Tag: 61391
inhserting and then updating info in headers programitically...how?
I am new with vba, first time using it and not much of a programmer at
all.
I have managed to create a macro that automatically detects landscape
and portrait pages, and then insert an autotext entry into their
headers (a different one for landscape and portrait). Now I need to
make the info in the headers come from an a userform or inputbox
(inpubox is prefered because is just two pieces of info and it seems
easier). So now what am I supposed to do?
My guess of what I have to do in order is this
1) modify the autotext entry to include some sort of field
a) DocVariable?
b) REF ?
c) Bookmark?
Can you please tell me which of these I need and give me a precise
example
of how to add this? (I believe each of the three is added in a
different
way).
Also, it seems the term Bookmark and REF field are either used
interchangeably or are intimately related...can you please tell me
what
each one is used for?
2) Add some code in my macro to insert the text variable I collected
using the
InputBox into the field/variable/bookmark (whichever I am supposed
to use)
a) is this code supposed to be inserted at the very end of my code
since updating the field/REF/Bookmark/etc should automatically
replace everything?
b) or should I loop through all my sections and replace the variable
one by
one? I currently go through all the sections to insert the
autotext, so I
suppose I could just add this command after the autotext is
inserted.
Either way, can you please show me the exact code I have to write to
get
this to work. I mention again its for headers since I read its a
different
approach (probably using ranges, which I still dont understand well)
3) Finally I believe I have to update the fields in some way so that
they
reflect the inserted variable in my word document.
a) is this just one command or another loop through the whole
document since
it is a header?
Can you please show me this code also?
I have been looking through newsgroups since thursday afternoon, and
have
beem trying once thing after the other, and I have not been very lucky.
I always seem to either delete the autotext completely, get a type
mismatch
when trying to assign the variable, or simply acomplish nothing. Its
very
frustrating. I have already ordered a word book from amazon hopefully
that
will help me out in the long run, but I need some help right now.
please....
help!!!!!
By the way, I use word xp and word 2003 in to machines, and this whole
programming thing came up because I am sick and tired of having to
print
out my documents in sections. I want landscape pages to print with
portrait
headers and portrait pages to print normally (with portrait headers).
Like I said, I have resolved everything but this last step..the
variables.
My documents have many continous sections, and I detect and correctly
apply
the right header (a normal one for portrait and a frame based one for
landscape ones). I am soooooo close, yet its been three days going
around in circles
with this.
Thanks in advance for the help you might be able to provide. And
please, give me an example of the exact code, please dont assume that
by saying "use ASK REF fields" (or something similar) I will know what
you are saying...cause I dont.
I have gone through dozens of usenet articles and tried to piece all
this info and have been unsuccesfull. Sorry for asking for so much, but
its late and I am really frustrated.
thanks!!!!! Tag: how to create unicode text dictionary Tag: 61390
Hyperlink to Full Screen .pps
Does anyone know if there is there a way to program a hyperlink from Word to
a Powerpoint presentation (.pps) so that the presentation appears
automatically on a Full Screen rather than with the toolbars showing?
I am working with Office 2000.
Thank you.
--
Mark L Tag: how to create unicode text dictionary Tag: 61388
Blank Document Not Blank
I have read and successfully resolved the cleanup of Normal.dot. The
Webmaster asked the question, How does it happen that people who have never
heard of Normal.dot and don't know how to find it somehow manage to save a
document in it? For me, it happened when I highlighted a person's name and
address in a Microsoft Word letter, then hit Tools--Envelopes and Address,
and the address showed up in the envelope address box. After this, the
person's name and address continually opened up everytime I opened Microsoft
Word. After I performed a mail merge with multiple names, all of these names
started showing up on the Microsoft Word starting document instead of the
single person's name and address. I hope that this helps someone with more
knowledge than me about software. Tag: how to create unicode text dictionary Tag: 61386
word 2003 add delete buttons in custom properties fields dialog box disabled...why?
1) I am following some tutorials on VBA specifically to learn the
DocVariable fields. It says I should go to the File/Properties/Custom
dialog box and add the field there first. I go there and can type the
name of the field, select the type and even type a value, but the ADD
DELETE buttons are always grayed out. They stay gray even after
populating the boxes. I tried a blank document, an old document,
etc....same thing...tried closing opening word again...same thing.
I am using Word 2003.
2) the reason I am looking into DocVariable is that I want to
programmatically insert different Autotext into the headers (different
one for each odd portrait, even portrait, odd landscape, even
landscape). I am now able to differentiate portrait/landscape sections,
insert different even odd autotext headers...I can now even get the
info I need from the user using an inputbox, but now I have to place
the info I get from the input box into a variable field in the autotext
entries. From what I read, DocVariable is the way to go....am I right?
Any other suggestions?
thanks. Tag: how to create unicode text dictionary Tag: 61369
add delete custom fields in properties window disabled...why?
1) I am following some tutorials on VBA specifically to learn the
DocVariable fields. It says I should go to the File/Properties/Custom
dialog box and add the field there first. I go there and can type the
name of the field, select the type and even type a value, but the ADD
DELETE buttons are always grayed out. They stay gray even after
populating the boxes. I tried a blank document, an old document,
etc....same thing...tried closing opening word again...same thing.
I am using Word 2003 on a public computer (I pay to access it), could
this be a security setting in the computer? I was told that the
computers are completely open and nothing is prohibited, so I doubt it
might be anything like that. Any ideas?
2) the reason I am looking into DocVariable is that I want to
programmatically insert different Autotext into the headers (different
one for each odd portrait, even portrait, odd landscape, even
landscape). I am now able to differentiate portrait/landscape sections,
insert different even odd autotext headers...I can now even get the
info I need from the user using an inputbox, but now I have to place
the info I get from the input box into a variable field in the autotext
entries. From what I read, DocVariable is the way to go....am I right?
Any other suggestions?
thanks. Tag: how to create unicode text dictionary Tag: 61368
Adding Rows to Locked Table
Hello all,
I'm a relative newbie to Macro coding, and I need some help with a project
that I tackled that has turned out much more complex than I originally
anticipated.
I have a table in a locked template. What I'd like to create are...
1. two buttons for adding rows, each button will add a row with a unique
style (i.e. one for row with blue background, 12pt font, one for row with
white background, 11pt font)
2. each cell in each row must contain a text form field. this would seem to
be the most difficult part of the project.
3. a third button to delete whichever row the cursor is in.
I know how to unlock/lock the form, I just am not familiar with the commands
to add/delete rows and the variables for the different styles.
Any help is extraordinarily appreciated!
gotham Tag: how to create unicode text dictionary Tag: 61367
Unable to merge
I am currently using MS Word 2002 (10.6612.6714) SP3 and MS Outlook 2003
(11.6359.6360) SP1. When I want to create a merge file I want to use the data
from my Outlook Contact folder. The process I use is as follows: Tools,
Letters and Mailings, Envelopes and Labels. I then select "Insert Address",
and in the Select Name window, the Outlook Address Book is shown in the "Show
Names from the:" field and "No entries in this Address Book" is indicated. I
then select "Contacts" from the drop down window and replace the "Outlook
Address Book" in the 'show names from the:' field. At this point I receive a
Mircosoft Word message "Microsoft Wor has encountered a problem and needs to
close...
The error signature is as follows:
AppName: winword.exe AppVer: 10.0.6612.0 ModName: msvcrt.dll
ModVer: 7.0.2600.2180 Offset: 000380b8
Any feedback/assistance would be greatly appreciated... Tag: how to create unicode text dictionary Tag: 61366
Help with Error Handling
Despite reading the help file until my eyes are blurry, I still can't get my
head around Error Handling.
I have some code provided below that can cause an error if the user inputs
and incorrect format. I would appreciate any feedback regarding the Error
Handling that I have used. While it appears to work, I am not sure if I
have left a door open somewhere that would incude other errors for fail to
detect other errors.
Thanks.
Dim myDate As Date
Dim seqNum As Long
Dim seqLength As Long
Dim seqInt As Long
Dim upSeq As Long
Dim i As Long
Dim dateFormat As String
Retry:
On Error GoTo Oops
myDate = InputBox("Enter the start date in 1/31/05 format.", _
"Start On", Date)
seqLength = InputBox("Enter the sequence length e.g., 14.", _
"Sequence Length", "14")
dateFormat = InputBox("Enter the format for the date display e.g." _
& "dddd, mmm dd yyyy.", "Date Format", "mmmm dd, yyyy")
seqInt = InputBox("Enter the sequence interval.", "Interval", "1")
For seqNum = 1 To seqLength
upSeq = seqNum * seqInt
ActiveDocument.Variables("Var" & seqNum).Value = _
Format(myDate + upSeq - seqInt, dateFormat)
Next
ActiveDocument.Fields.Update
Exit Sub
Oops:
If Err.Number = 13 Then
If MsgBox("Invalid format! Start date must be in 1/31/2005 format", _
vbRetryCancel, "Alert") = vbRetry Then
Resume Retry
End If
Resume Next
End If
End Sub
--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support Tag: how to create unicode text dictionary Tag: 61363
Macro to create section
Hello,
I'm hoping someone might be able to "donate" some code for two seperate
case:
1- Create a page after the last page in the document wish would be in a new
section.
2- Change the page setup of the current document so that the current page
would be the start of a new section
Thanks for the help. I'm having a really hard time programming anything to
do with section management?!
Daniel Tag: how to create unicode text dictionary Tag: 61360
Problem updating references earlier version
Hello,
I have a VB6/MS Office Excel/Word VBA app configured in Win XP Office 2003.
I am trying to make it compatible with earlier versions of Office-Office 97
on a Win 98 platform at present-and after researching have decided to try
late binding. According to MS documentation, the application should update
its references when opened in the earlier Office 97 version. It has done this
for 6 of 8 references: except for the MS Word reference-it is still looking
for Word 11.0 in the same location as was on the original, newer platform.
Then it is also looking for the MS VBA Extensibility 5.3 file in the location
of the original, newer platform as well.
Does anyone have an idea how I can get my app to point to the correct 2
references per above? Also should the Extensibility reference be to the newer
5.3 version (vbe6ext.olb) which per KB article 269116 is a replacement for
the earlier older type library (which I am guessing is vbeext1.olb as that is
what I find on my Office 97 platform);and if so 1) should I add that to my
installer application. 2) how do I get it to point to the correct location?
Will I need to use code to locate and set the reference to the file?
Thanks, blessings
Van Tag: how to create unicode text dictionary Tag: 61350
One more TOC question
When I already know a TOC item
(MyDoc.TablesOfContents[1].Range.Paragraphs[1]), how can i select the
corespending content in the document?
What I am trying to do is that I have a TOC like:
Section 1
-- Section 1.1
-- Section 1.2
I need to copy the part of the document linked to the Section 1.2.
thanks for help
Tomcat Tag: how to create unicode text dictionary Tag: 61347
Dual page numbering and TOC
Per article 291283 "seq method", how do I set correct page numbering for the
TOC? Tag: how to create unicode text dictionary Tag: 61345
Dual page numbering and TOC
Per article 291283 "seq method", how do I set correct page numbering for the
TOC? Tag: how to create unicode text dictionary Tag: 61344
WordBasic.Call to function in a module?
I've got a .dot file on a pc here at the office that is used via Word (i.e.
File | New ) to create a document based upon some data in an access database
located on a network share that all PCs have a drive mapped to. The
original developer is no longer here and I'm trying to move that .dot file
to another PC so the user there can use it. So, I copied the .dot file to
the same templates folder on the other PC. When I run the code, I get an
error that the "Object doesn't support this property of method".
I click the debug button and an instance of the VB editor launches and I see
that the problem is in a call to WordBasic.Call. The problem is the first
parameter. It is referencing a procedure in a module in argument is in the
form of "mymod.someprocedure$". I know this is something that we coded
in-house because of the name of mymod and the context of the call (it's
calculating something specific to our business).
I assume the file, etc. that contains the code that WordBasic.Call is trying
to call is on the old PC, but I just don't know what I should be looking
for. So, what I'm trying to figure out is, in the VBA world, what form does
a "module" take and how is it referenced by the vba code and/or the .dot
file. Any help I could get to make this .dot work on the other PC would be
much appreciated.
Thanks! Tag: how to create unicode text dictionary Tag: 61339
Open a web page from vba
How do I open a webpage from vba? I can't quite get the Shell syntax to
work for this.
Thanks.
Larry Tag: how to create unicode text dictionary Tag: 61338
Corrupted Table Error Message
When I open a document I receive an error message regarding a corrupted table
I am trying to delete the corrupted table. I canâ??t even see the table but
the following line reveals that I have 2 in a document:
ActiveDocument.Tables.Count
When I use code to go to the table: ActiveDocument.Tables.items(1).select, I
move to down about 20 pages to the table. I canâ??t see the table but ASSUME
that it is selected. If I try ActiveDocument.Tables.items(1).delete then the
table is not deleted.
Any thought?
Thanks in advance,
Stewart Rogers Tag: how to create unicode text dictionary Tag: 61337
Create Sequential Dates
Hello Teachers,
Today I spent some time trying to come up with a way to enter a
sequence of dates in a document. Basically the OP had an Itenerary
Day 1 Jan 07, 2005
Day 2 Jan 08, 2005
etc.
I posted a solution where the user would run a macro to create a
collection of numbered DocVariables each storing the next days date.
Then in the document I inserted DocVariable fields with nested Quote
and Seq fields.
Day {Seq Date} { DocVariable{ Quote Var{ Seq dayNum }}
Day {Seq Date} { DocVariable{ Quote Var{ Seq dayNum }}
etc.
The macro to create the DocVariables follows:
Sub DateSeq()
Dim myDate As Date
Dim dayNum As Long
Dim numDays As Long
myDate = InputBox("Enter the start date in 1/31/2005 format.", "Start
On", Date)
numDays = InputBox("Enter the sequence length in days.", "Sequence
Length", "14")
For dayNum = 0 To numDays
ActiveDocument.Variables("Var" & dayNum).Value = Format(myDate +
dayNum - 1, "dddd, mmm d yyyy")
Next
ActiveDocument.Fields.Update
End Sub
I looked through the Google data base for anything close and didn't
seeing anything. This seems to work, but I am to declare victory. I
would appreaciate any comments on this method or suggestions for a
better method.
Thanks Tag: how to create unicode text dictionary Tag: 61336
Can I use a combo box without locking the document?
This is because, I want to set up a template and use a combo box, but if I
lock the document, I won't be able to write in it.
Thanks Tag: how to create unicode text dictionary Tag: 61333
Not stopping at breakpoint - upgrading from Word 97 to 2003
We're upgrading from Word 97 to Word 2003. In 97 I could open a template,
open the vb editor, make some changes in the code, (not saving them in case
they were incorrect), put in some breakpoints, then go to File/New/General/
select my template, test run the macro and it would stop at my set
breakpoints. When I test a macro in 2003, it doesn't stop at the set
breakpoint. It's like it's opening the saved version of the macro instead of
running the one I already have open. I don't want to just hit run because I
don't want the macro to insert data into my master template. Is there some
setting that needs to be changed in Word 2003 that I'm missing?
Thanks for your help Tag: how to create unicode text dictionary Tag: 61331
getting date & time of a file from web site?
Hi Folks,
How can I get the date and time of a file from a website? Say I wanted
to know the last time my site pages were updated, I'd use something like:
FileDateTime("http://www.mysite.com/index.html")
Any Ideas?
Cheers
JohnnyB Tag: how to create unicode text dictionary Tag: 61327
reducing font of a bookmark field
I'd like to add some code that would check to see if the text of a bookmark
field is two lines (containing a paragraph mark) and if it is, then to reduce
the font of all those bookmarks to 10 point so it will fit in the allotted
space in my form. Thanks, charlie Tag: how to create unicode text dictionary Tag: 61325
vba template- macro security setting problem...
Hi,
g'd morning. i have a word xp template which has active objs. it is working
fine on all computers except a single user. the user has windows xp with sp 2
and office xp installed vs. windows xp with sp 1 on all other machines. it
has icons linked to macros which pop up vb forms. as soon as i click the
icons, i got the "the macro can't be found or has been disabled because of
your macor security setting". then, the template crashed with 0x8000FFF
catastrophic failure error. does anyone has any experience with that?
thank you,
will
-- Tag: how to create unicode text dictionary Tag: 61324
saving text
Here's my question....is it possible to write into a Word
macro:
copy text|open wordpad|paste text|save as Text.txt (to
desktop)|close
Wordpad|close Word active document.
I'm having an issue that this would solve entirely but I
dont know if its possible to
involve another program in a Word macro. Tag: how to create unicode text dictionary Tag: 61323
Get *.doc and *.rtf files in 1 folder listed on a UserForm?
Is it possible to get all *doc and *.rtf files in a selected folder on a
user form in Word XP?
Any idea how I could tackle this problem? Or are there any examples
around from which i could copy and paste the structure?
*Background info: Some of the files will be selected on the user form by
the user. Also, the user will set only one of the files as the "main
file". Only selected files will be processed by another macro. The main
file will be processed differently. The files should be displayed on the
form with radio buttons.
Ciao,
ANDy Tag: how to create unicode text dictionary Tag: 61314
Tools for creating application to integrate with Word
Hi, I'm going to write a program that is to be integrated with word and I
don't quite know where to start. I've been fiddling with VBA for a while but
there are too many limitations. I need to know what tools will make the task
easier.
- It should be possible to fire via a word toolbar.
- I need to use functions that are obviously used internally by Word but
that I can't find in the VBA docs, like the _correct_ word count as opposed
to the one described in the docs that counts newlines and punctuation. I can
write my own, but prefer to use what already exists.
- I need to package the program nicely so it's easy to install.
What tool(s) will be more helpful? Should I go with .NET? Which programming
language? I know C++ well, and some VBA. Perhaps C#?
Any pointers will be greatly appreciated!
Thanks :-) Tag: how to create unicode text dictionary Tag: 61313
Changing Styles
This is crazy. I am trying to change the style "COOL" in the document to
another style called "NOTSOCOOL". I wrote this:
With ActiveDocument.Range.Find
.Style = "COOL"
.ClearFormatting
.MatchWildcards = False
With .Replacement
.Style = "NOTSOCOOL"
End With
.Execute Replace:=wdReplaceAll
End With
Doesn't work! I am positive that nothing extra is set, the same code (when
.style is removed and .text is added) finds and replaces words with no
problems. The styles definitely exist and I did a manual Find and Replace
(Edit - Find) and it works fine.
What's wrong with the code?
Thank you for your time / response
Vince Tag: how to create unicode text dictionary Tag: 61301
Limits in Heading Numbered paragraphs and cross references
Anybody know of "documentation" of the apparent limits in Word(97, 2000,
2002. 2003) that apply to heading numbering. I used Word 2003 for the
following.
I tried to find out how many heading numbered paragraphs could be contained
in a single document.
So I wrote a little macro to keep generating paragraphs, each consisting of
only the counter.
I interrupted the macro when the count got to a bit under 36000. I then
applied the Heading 1 style to the whole document.
So each paragraph is numbered from 1 to the number of paragraphs and the
text of the paragraph is the same as the paragraph number.
I then used the Insert | References menu to insert a reference, initially
using the /h option.
I was able to successfully insert a reference to the number of the last
paragraph, however, when I almost immediately followed that by attempting to
insert a reference to the paragraph's text, the cross reference inserted was
to an entirely different paragraph.
I tried a few more insertions, eventually getting to the point where the
incorrect cross reference was always inserted, and finally to a point where
the Insert Cross Reference dialog, in effect, blew up. Ultimately, an
attempt to insert a reference to the later paragraphs, caused things to hang
AND the first 32767 items disappeared from the list of headings in the cross
reference dialog.
In addition, Norton Auntie Virus 2004 got blown out of the System tray. I
did not notice the point at which this occurred. Note that I do not use the
NAV Office plug-in and I disabled NAV's Autoprotect when I ran the macro, so
NAV should not have been poking around.
Perhaps, most important, I noticed the following.
While scrolling thru the list of Headings in the cross reference menu, the
first 32767 were listed in a normal font, but starting with 32768, both the
paragraph number and text are dimmed
My questions include:
1. What is the limit on the number of Heading numbered paragraphs that may
be included in a document?
2. What is the limit on the number of such paragraphs that may be
consistently cross referenced via the cross reference menu?
I do recall seeing a statement that the number of bookmarks in a document
is limited to about 16K. Obviously, that places an upper limit on the number
of heading paragraphs that can be cross referenced, and the number is
reduced further by other bookmarks that may be used in the document.
So, I also must wonder why Word allows the inclusion of more heading
paragraphs than the bookmark limit without some sort of warning? Heck, I
imagine if I tried to generate a TOC, things really would have gone haywire.
And, of course, my last silly question, where's the documentation?
--
http://www.standards.com/; See Howard Kaikow's web site. Tag: how to create unicode text dictionary Tag: 61300
Storing Program Settings
Hello,
I have around 30 (at most) text boxes and combo boxes that have settings
which need to be stored and restored when the program starts. (This is a VBA
program but I think, it also applies to VB). In the future, many more
settings could be added and they would also have to be saved and loaded
(like a template a program uses for different conditions). I am not sure
about the best way to go about this that could save coding in the long run.
I wanted to write a text file like:
Condition1;Value1;Value2;Value3
Condition2;Value1;Value2;Value3
Condition3;Value1;Value2;Value3
and when loading this file, to load (say) the first three textboxes with
their corresponding values, I would split each line and check the condition
and populate the textboxes / comboboxes. Is this the best way to do this?
Thank you for your time / responses.
Vince Tag: how to create unicode text dictionary Tag: 61296
How to get the "next table" and the "previous table"
There are some tables in my document, and the cusor focus in somewhere.
How can I get the object of next table, like this statement:
Set oTab = Selection.Tables(1).Next 'this is pseudocode Tag: how to create unicode text dictionary Tag: 61294
Running a Macro in a Template, on Event
Hi.
I have a macro that I've constructed in word which will insert bookmarks as
per a table template that I've created in our Visual FoxPro based
database/frontend. The Visual FoxPro frontend inserts this information into
Word - and I've also instructed it to use a word template which contains my
Macro
The Macro works fine, but what I'm wanting to do is automate the process,
rather than having to run the Macro once the document has been produced from
FoxPro, using the .dot file.
Is there any way to make this happen? I've tried several of the On-Events
but none of them seem to work. What I basically want it to do, is once the
Document has been opened and the information has been sent to it from our
FoxPro database, that the Macro automatically runs
Thanks in Advance
David Bloch
Houston Medical Tag: how to create unicode text dictionary Tag: 61290
Word Template - wanting to run a Macro on opening
Hi
I have a Word template that I've created which has a macro attached to
insert bookmarks across a letter template we have in our database
system. The database system uses the object libraries in Word to
create the Word Document and can use a template to start its design
with.
This works fine and the Macro will work across the letter template we
extract from our database. What I am wanting to do is make the code
run automatically as soon as the template has been opened.
Here is the code I have so far.
Sub Bookmarks()
'Enter the number of lines in the letterhead. I.E six lines is 11
LineCount = 11
' Pat Name Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Patient Name:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="patname"
' Your Ref Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Your Ref:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="yourref"
' Address Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Address:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="address"
' Our Ref Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Our Ref:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="ourref"
'DOB Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "DOB:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="dob"
' Reqdate Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Request Date:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="reqdate"
' Sex Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Sex:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="sex"
' CollectDate Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Collection Date:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="collectdate"
' Medicare Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Medicare No:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="medicare"
' RecDoc Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Receiving Doctor:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="recdoc"
' RecDocRef Bookmark
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="RecDocRef"
' CopyToDoc Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Copy To Doctor:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="copytodoc"
' CopyToDocRef Bookmark
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="copytodocref"
' Examination Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "Examination:"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="examination"
' Findings Bookmark
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst,
Count:=LineCount
With Selection.Find
.Text = "$$"
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCell
ActiveDocument.Bookmarks.Add Range:=Selection.Range,
Name:="Findings"
' Go Back to Top of Document
Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst
End Sub
With another part of code.
Public WithEvents appWord As Word.Application
Private Sub appWord_NewDocument(ByVal Doc As Document)
Call Bookmarks
End Sub
In the Documents
How can I make this automate once the merge from our database to the
word template is complete? Tag: how to create unicode text dictionary Tag: 61288
Not Visible Files
I have a routine that performs functions A,B & C when a document is open
(determined by "If Documents.count>0") and functions D,E & F when no documents
are open (and the screen is 'grey').
Ocassionally a file that I opened in VBA with the "visible:=False" method
set apparently is still technically open although it appears not to be (i.e.,
the screen is grey) (and it is not supposed to be. The routine that was
supposed to close it did not.)
How can I test for the existence of an open, not visible document.and then
close it? Documents.count always returns 1 in this situation but if I try to
close the ActiveDocument I get a runtime error saying that the function cannot
be performed because no document is open.
Thanks,
Ed Tag: how to create unicode text dictionary Tag: 61285
How do I get rid of the PDFMaker error message in WORD 2003?
I have followed the suggested remedy downloading any update from Adobe. I
still get the error message each time I open WORD. I tride the workaround
suggested in the message but the filename was not found. How do I get rid of
this message for good? Tag: how to create unicode text dictionary Tag: 61282
VBScript: Printing question...
I have some VBScript (in an Outlook Form), that calls
"CreateObject("Word.Application"). The script processes some data then at
the end of the procedure prints out the result. This works fine on my local
machine, however, if another user attempts the same process it does not print
the output.
Ref: [msgbox "Printing to " & objWord.ActivePrinter] below...
I added the msgbox, and now verified that on each machine the correct
printer is configured (or displayed) in the msgbox. But, the form does not
print. What I observe is; the item shows up in the respective printer
queue(s) (but only for a very brief second) then vanishes and nothing
prints... Suggestions/comments?
Current working code (except printing on other machines...)
'----------------------Printing Routine------------------------
Dim objWord
Dim strTemplate
Dim strField
Dim strField1
Dim objDoc
Dim objMark
Dim mybklist
Dim counter
Sub cmdPrint_Click()
Item.Save
Set objWord = CreateObject("Word.Application")
' Put the name of the Word template that contains the bookmarks
strTemplate = "OSR.dot"
' Location of Word template; could be on a shared LAN
strTemplate = "\\ivory\forms\" & strTemplate
Set objDoc = objWord.Documents.Add(strTemplate)
Set mybklist = objDoc.Bookmarks
For counter = 1 to mybklist.count
Set objMark = objDoc.Bookmarks(counter)
strField = objMark.Name
If strField = "SentField" then
strField1 = CStr(Item.SentOn)
Else
strField1 = Item.UserProperties(strField)
End If
objMark.Range.InsertBefore strField1
Next
msgbox "Printing to " & objWord.ActivePrinter
objDoc.PrintOut
objWord.Quit(0)
End Sub
Thanks VERY much, in advance!
Bill Billmire -
--
Bill Billmire Tag: how to create unicode text dictionary Tag: 61279
Tab Position
Hi,
I am new to VBA in Word. Would anyone be able to answer
this:
If I have two tabs and I am at the position starting at
the second tab, how can I determine in VBA if there is
anything at the first tab on the next line. For example:
Tab 1 Tab 2
Line 1 Some Text Some other text
Line 2 Yet more text
If there is a paragraph mark at the end of "Some other
text" on Line 1, when I return to the start of the next
line, how can I determine if there is anything at Tab 1
for the second line?
I hope I am explaining this clear enough! Any help would
be appreciated.
Thanks. Tag: how to create unicode text dictionary Tag: 61278
identifying most recently used symbol (via VBA) in MSO2003, as shown in the insert symbol dialogue box
Does anyone know where the information for the most recently used symbol can
be accessed via VBA? It must be stored somewhere, because it is the leftmost
symbol of the recently used symbols in the insert symbol dialogue box.
I often use the same symbol lots of times in a single document, so I want to
assign a macro to a custom button that simply inserts whatever the last
symbol was that was inserted in the document. It'll still be better than
using the keyboard shortcut, for example [<alt>+0176], assuming I could even
remember the keyboard shortcut... :-/
Thanks!
Keith
--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own. Tag: how to create unicode text dictionary Tag: 61276
Word Field Merge with Excel
Hello,
What procedure would I need to follow to have a field in MS Word import/fill
with values from MS Excel on a cell-by-cell basis (i.e. value from A1, A2,
A3, A4 etc.)
Your help would be greatly appreciated.
Ed Tag: how to create unicode text dictionary Tag: 61271
Macros Disabled in Word 2003
Hi,
I am trying to run a macro but I continue to get an error message indicating
that macros are disabled, I have followed the steps outlined in the online
help but this does not appear to make any diff. I can open up the macro and
get it to run on my desktop but not on the laptop.
Any help would be appreciated. Tag: how to create unicode text dictionary Tag: 61270
Macros
I am trying to make two simple macros which do not seem to work. If you can
help I would really appreciate it.
(1) I am trying to make a macro to go into Edit, Paste Special,
Unformatted Text. Every time I try to do it, the macro runs with the text
formatted.
(2) Word's toolbar print button when pressed, automatically prints the
page without giving you the Print dialog box first. So I am trying to make a
macro to print with the dialog box opening so I can then put it on the
toolbar. But I cannot end the macro with the dialog box open - it won't
allow it. Tag: how to create unicode text dictionary Tag: 61264
How to serach breaks of sections, columns or text wrappings?
Is there a way to find these breaks in a document in Word XP? Do these
breaks have vb constants for which one could search with VBA?
TIA,
ANDy
-- Tag: how to create unicode text dictionary Tag: 61263
Checkbox form
When I add a checkbox to my template, the document creates an X in the box
instead of a checkmark. Does anyone know how to change that? I can't find
the answer anywhere. Why would a check box button create an x?
thanks Tag: how to create unicode text dictionary Tag: 61258
Find the value of an charecter adjacent to the selection?
I would like to step through a document until a full stop is found and
then insert a character IF the next character is a space.
So I look for a "." with Selection.Find, but how could I proceed then?
Does Word XP VBA have a built-in function to evaluate the character next
to the position where the Find statement brings me (the selection
containing the full stop)?
Best,
ANDy
-- Tag: how to create unicode text dictionary Tag: 61252
how do you create a dictionary for unicode text. thank you for any help.