Automatically update
Hi
I have a field for "last save by" in document. When I save, I would this
field should automatic update.Please help!
--
Anni Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96783
VBA in Word 2007
I have an application that creates reports from my database using VBA macros.
It has been rather videly used for several years now. I have tried to look at
word 2007 specs but cannot find any mention of VBA. Will VBA still be
supported in word 2007? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96782
page numbering
I need some help on page numbering. I am creating a template for our
procedure group. In the header I have the page numbering (X of Y) for the
hole document. In the attachment page of my template, I created a footer so I
can number the pages of each attachment. An example would be Attachment 1
Pages 1 of 3, Attachment 2 Pages 1 of 10 and so on. I went out and looked at
â??How to Create Two-Page Numbering Schemes in One Documentâ?? but it looked like
I needed to know how many attachments(they call it sections) are in the
document. My problem is the number of attachments change with each new
document. One document could have only 1 attachment and the next could have
30 attachments. Is there a way to set it up so I donâ??t have to know how many
attachments there are? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96780
word counts diff in Word and macro
Hi,
Does anyone know how to count special characters within a range?
A macro that includes ActiveDocument.Words.count gives a different result
for count than Word's word count toolbar. The latter produces the right
result. The macro seems to be including the "paragraph mark" and other items
such as "*" "%" etc. as separate words even though I have them directly
adjacent to words.
I would like to make the count more precise and thus would like to subtract
the number of times these special characters appear in the document and
range.
I can count these special characters in the entire document by looping
through ActiveDocument.Characters and selecting those that have ascii values
equal to, less than or greater than certain values (see code after my
signature). But I don't know how to do this within a range and a macro I am
working on needs to have that ability.
Any help would be appreciated. It will probably be enough to just give me
the equivalent of ActiveDocument.Characters for a loop through a range.
--
eugene
PS Can anyone influence Microsoft to fix this. It is quite odd for there to
be such a difference and is quite disturbing that the macro can't do it right.
CODE
Doug Robbins response to "Count Uppercase alphabets" posted 1/3/07
Dim i As Long, achar As Range
i = 0
For Each achar In ActiveDocument.Characters
If Asc(achar) > 64 Then
If Asc(achar) < 91 Then
i = i + 1
End If
End If
Next achar
MsgBox i Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96779
Grabbing an Outline Heading
In an outline numbered document, does the body text know anything
about the outline section in which it appears? I have an outline
numbered document and want to create a macro tol capture certain text
from the body, and in the front of the text, I want to put the level 3
outline heading of the section where the text appears. For example:
1. My House
A. Furniture
(1) Living Room
Coffee table
Sofa
Chair
End Table
(2) Kitchen
Dining Table
Chairs
B. Books
(1) Computer
ASP.Net Coding Strategies
Pivot Table Data Crunching
(2) Philosophy
Kitchen Table Wisdom
This was Cicero
The individual items are just body text.
Suppose I want to gather up a list of all the "tables", precede each
one with the room where it appears, and paste it into a second
document. The result would look like this:
Living Room: Coffee table
Living Room: End Table
Kitchen: Dining Table
Computer: Pivot Table Data Crunching
Philosophy: Kitchen Table Wisdom
I want to search for the word "table," select and copy that line, and
then grab the appropriate heading and stick it on the front, without
ever actually selecting and copying the heading. Is it possible? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96771
Can't get macro to add header or number pages in Word 2007
I am trying to record a macro that does a variety of things, and can't get it
to work.
I want the macro, in addition to other things, to create a header; and I
want the header to include a line that says Page x of y.
When the macro gets to the point that it is to create the header, I get an
error message referring to "Run time error 5941" and telling me "the
requested member of the collection does not exist"
I also can't even find a page numbering option that allows me to have a Page
x of y format. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96768
Resizing pictures with VBA
I want to resize a selected picture using VBA but I only want to
change the width of the picture to say, 2cm and the height should
adjust to scale automatically.
Manually, using the Format>Picture command I can achieve this by
ensuring that Lock aspect ratio checkbox is True.
However, if I translate this to VBA using the following commands:
with Selection
.InlineShapes(1).LockAspectRatio = msoTrue
.InlineShapes(1).Width = CentimetersToPoints(2)
End With
...I would expect the same to happen as when I did it manually. Even
though the Lock aspect ratio is set to True it reduces the width to
2cm but leaves the height at its original value.
Am I using the correct commands, please? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96766
Can't run Word Viewer
Hi,
Someone please help. I've installed 2003 Word Viewer on my computer but
when I try to open it up and launch it I keep getting prompted to Reinstall
it. I then get through the prompts to reinstall untill I'm told Viewer has
been succussfully installed but the same problem persist. Everytime I try to
run the program I'm told to reinstall again. What is going on? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96760
5941 error on formfield code
I have a macro set for the 'Exit' of a checkbox. In the macro I have the
following:
If ActiveDocument.Formfields("Check1").Checkbox.Value = True Then
This line gives me an error 5941
'The requested member of the collection does not exist.'
The checkbox is called "Check1".
I even tried Msgbox(ActiveDocument.Formfields("Check1").Checkbox.Value) in
the Immediate Window and get the same results. Do I need a Reference
installed or something? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96751
expand to end of line
I need to find a character then select to the end of the current line,
but not select anything in front of the character. Later I will make
a font change but I can work that out...
Im working with:
With Selection.Find
.Text = myCharacter
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Select
Selection.Expand Unit:=wdWord
Selection.Select
Im trying different things in the WdUnits items and using the expand
function but I am stumped at this point.
Any help will be appreciated
Robert Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96749
Add picture to Word Document
I am trying to add pictures via VBA to a word document.
I used the Word Macro recorder to generate the code
needed to attach the pictures. When I the Access routine
I get the error message "This is not a vaild file name".
The picture attaches if the file name looks like:
"filename"
If I change the code so that the file name looks like:
strQuote & strfilename & strQuote
I get the error message. What am I missing?
Note that the strfilename is about 110 characters in lengh,
is this the problem?
Any help is appreciated. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96746
moving the cursor to find location
Hi,
How does one move the cursor to the beginning of a "find" location (in a
macro)?
I would like to select all the text from a point determined by a "find" back
to the beginning of the document. It seems that when I do find, the cursor
stays in its original location. How can I tell the cursor to move to the
"find" location?
I have tried the following in With .find ... While .execute:
Selection.MoveRight Unit:=wdCharacter, count:=1
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
but the cursor seems not to go down to the "find" location so only the first
character of the document is selected even though there are clear indications
that the loop is finding the correct number of items specified.
--
eugene Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96744
Code to access the menu options...
Is there a way I can access the menu options (File, Edit, View,
Insert, Format etc.) via vba code?
All help is appreciated. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96742
When opening Word, how can template also opens the Apply Styles
This is for Word 2007.
I have a custom template and want the Apply Styles window to open when
launching Word - can this be done through any settings in Word or is this
something that can be done progmatically?
Noted that if I attempt to record a macro where I click on Apply Styles (I
have it in my Quick Access toolbar), the action is not recorded. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96738
Can you apply styles as you write output to a Word doc?
I'm creating a Word doc with some VBA code. I'm getting all the content
correctly, but I need to apply some styles. The finished product could be
any number of the following chunks of text.
Section Label
Description: <some variable length text>
Notes: <some variable length text>
Version: <some variable length text>
Table with 2 columns and n rows
Section Label, Description, Notes and Version need to have the same style
applied. The text after the colons needs a different style. Can I apply
styles as I write these lines with Selection.TypeText? Or should I write all
the content and then rummage through the entire document object searching for
different pieces of text and apply the styles then? I've tried various
things with the Selection and Range objects with unexpected results.
Thanks,
Brian Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96736
macro to select text from one point to another
Hi,
I would like to mark up a text and have a macro select the pieces of text
from one mark to another (eg all text between * to %), copy it and then
paste it into a new file.
Any suggestions on how this can be done neatly?
(I can do the copy/paste part of it. But I don't know how to instruct
selection between the marks. I would suppose one could use find. But know how
to select when finding.)
--
eugene Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96728
Document Dropdowns Reference
How do I refer to a document dropdown without using its name. Like in
Excel I use Sheet1.DropDowns(dropdown_name). How can I do that in
Word? It's not a form fied so it does not work when I do FormFields. I
would like to have a loop for the dropdowns in my document. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96726
Deleting bookmarks doesn't work
Hi,
I have a template with 2 formfields containing the following
bookmarks:
- Name
- Place
The formfields are filled using a userform:
ActiveDocument.FormFields("Name").Result = Formname.Controls(Name)
ActiveDocument.FormFields("Place").Result = Formname.Controls(Place)
Then I want to insert a 'new page section' and in the new section I
want to insert the same template again, with thus the same bookmarks.
To prevent multiple bookmarks with the same name, I delete all
bookmarks before I make the new page section using:
ActiveDocument.Bookmarks("Name").Delete
ActiveDocument.Bookmarks("Place").Delete
I then insert the template on the second page.
What I want is to use the userform again to now fill the bookmarks on
the second page. However, if I use
ActiveDocument.FormFields("Name").Result = Formname.Controls(Name)
ActiveDocument.FormFields("Place").Result = Formname.Controls(Place)
again (assuming the Name bookmark is now on the second page due to the
template and having deleted all other bookmarks), the formfields on
the 1st page are filled again in stead of the second page.
It looks like the bookmark from the first page is not entirely
deleted! If I however unprotect the page and look in the property of
the formfield of the first page, there is no bookmark!
Can someone help me please?
Thanks, Mike Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96722
VBA Help File
Does anyone no if it is possible to open the VBA Help File from
Word2003 as a stand alone file? I find the new format of the VBA help
in Word2007 practically worthless. It contains very few examples, and
the very helpful "See also" feature is gone.
Thanks. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96720
Writing word doc using two language in parallel
I need to write contracts in two languages. I made to columns, one for each
language without any problems. But I also need to have separate TOC and
headings and numbering for each language. Do you have any suggestion to solve
this case? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96717
VBA when saving
I have to save some letters which I need to ensure have certain options
selected (or not as the case may be) each time I save. I know some of them
you can set and the settings will keep but some of them do not.
Could someone please help me out with the codes for Setting :
TOOLS|OPTIONS|SECURITY - Store Random Numbers to False
TOOLS|OPTIONS|EDIT - Keep Track of Formatting to False
TOOLS|OPTIONS|SAVE - Embed Smart Tags to False
I also need to save the letter with no Title in the PROPERTIES|SUMMARY.
Any help with this would be very much appreciated.
JayM Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96716
MsgBox showing all sections with respective headings
Below macro is showing all the sections of a document with their
respective first paragraph headings in a Message Box. It is working
fine. But ... please scroll down past the macro ...
Sub ShowSections()
Dim rnge As Range
Dim i As Long
Dim strHeadings As String
strHeadings = ""
With ActiveDocument
For i = 1 To .Sections.Count
Set rnge = .Sections(i).Range
rnge.End = rnge.End - 1
strHeadings = strHeadings & "Section " & i & ": " &
rnge.Paragraphs(1).Range.Text
Next i
End With
MsgBox strHeadings
End Sub
Now, here comes my question:
Some of these first paragraph headings feature the built-in numbering
(built-in numbered heading 1 paragraph style), like the following
example shows:
Section 1: Cover Sheet
Section 2: Table of Contents
Section 3: 1. Introduction
Section 4: 2. Relative Analysis
Section 5: 3. Conclusion
Section 6: Appendix
Section 7: Bibliography
How do I have to re-write above macro that the numbering is shown as
well? Now only the text of the headings that are positioned at the top
of each section are shown, but their numbering (1., 2., 3., etc.)
where applicable should show as well.
Help is appreciated. Thank you very much in advance. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96703
Prevent users from changing Text without Document Protection
Hi,
I would like to create a macro that will prevent users from changing
certain text in the document.
The text is a field in Section 1 of the document. The field is
DOCPROPERTY Title. I always want them to use File > Properties to
update the title, not change the title within the document by
overwriting the field (most of the users would not know what a field
is). I would like that as soon as they try to delete or overwrite or
even select the title, that a message box comes up to say "Please go
to File > Properties" to change the title.
I do not want to use Document Protection as it is too restrictive for
the rest of the document.
I have seen some code that will prevent changes to the header or
footer, which I will implement for the DOCPROPERTY fields in the
header and footer, but I would like to be able to do it for the
document text itself also.
My thoughts on how to do it would be to restrict any changes within a
section (if they select any text within Section 1 pop up an error
message) or if they select any text between two bookmarks.
I'm just not sure how to code this, can anyone help? Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96700
Table Formatting in Protected Document
Is it possible to allow table formatting such as inserting a new row,
controlling page breaks within the table, etc. to occur in a document that is
protected? In my document, I need to allow such formatting to occur so users
can control the flow of information. However, I do not want them changing any
of the information that appears in the table itself. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96699
Calculating from a dropdown box?
How do I get a calculation to work from a dropdown box in a Word Form?
I know how to make =(Field1)*(Field2) work properly but what if one of the
fields is a dropdown box? That normal formula isn't working. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96698
Current Page # (even vs odd)
Hi,
I'm trying to write the code to determine:
a) what the current page number is (even where there is no page numbering
inserted in the doc) and;
b) determine if it is even/odd number (without 'reflected margin feature')
I have a large number of small documents that are being appended to one
another and I need to ensure that the first page always starts on an odd page.
Thanks,
Jille Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96693
Moving text along cells in a table
I have a question I am asking my users: Do you have a priority fee?
If they do, then I want an extra row in the table inserted with the
appropriate text in the appropriate column. In this table there are three
columns. I've taken a stab at it, but it obviously doesn't work. This is
what I had:
{ASK [PriorityFee] "Do you have a priority fee? If so, enter 'Yes'"}{IF
{REF PriorityFee} = "Yes""{NextCell}$100.00{NextCell}{NextCell}"}
Could someone please steer me in the right direction. By the way, the
document has to be in rtf format so I cannot embed macros. Thanks! Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96692
Populate Dropdown Box in Word
I have a drop down in my word document. It's not a list, but a form
drop down (HTMLSelect) using the Web Tools toolbar. I want to
populate
this drop down with values from an Excel sheet. How do I do this? I'm
connecting to Excel, but unable to figure out how to populate the drop
down. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96691
MailMerge API Trouble
Hello All,
I have a question about MailMerge from within an api call. I have
word doc set up using the mailmerge wizard that creates an SQL
Server .odc file to use as a datasource. I am calling the
OpenDataSource method (o1.ActiveDocument.MailMerge.OpenDataSource(...)
via a PowerBuilder app. All is well. However, I have one client that
is getting DB errors when trying to run.
The .odc connection is pointing to a view that has public
permissions. Looking at the SQL trace, there is an exec sp_cursoropen
line containing a select statement from the view. Followed by an exec
sp_cursorfetch. Followed by an exec sp_cursorclose. Then a couple of
BatchCompleted lines. All is well.
Then these several lines repeat (within the trace) and I get an error
after the second exec sp_cursorclose 180150000. The errors are Error:
208, Severity: 16, State: 1 followed by Error: 16945, Severity: 16,
State: 1.
Digging through posts on these errors, I see that 208 is roughly 'file
not found' and 16945 is trouble with the cursor.
Why might the first time through these statements be OK and the second
time produce errors? I am running SQL Server 2000 sp4, my client is
running 2000 sp3. I am on Word 2003 sp2, the client is on word 2002
sp3.
I cannot recreate these errors in my environment, but the client has
sent me his traces and I see where (but not why) the error is
occuring.
Any ideas?
Thanks in advance,
Brian Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96689
Do loops and omit a couple of iterations?
I wonder whether it is possible to iterate through a collection of
objects and omit a couple of iterations, such as
Dim i as integer
For i = 1 to 7 Skip 3,4
Set tbl = ActiveDocument.Tables(i)
If tbl.Rows(1) etc. then
do stuff
End If
Next i
Is this possible, ie. skip the third and fourth table ? `
Help is appreciated. Thank you very much in advance.
Regards,
Andreas Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96685
Default Print Dialog Window Changed
In Word 2003 the default print dialog was customized by an employee who is no
longer with us; a new print form was created and the appropriate options
added to include a document footer checkbox and a checkbox to not bill the
print job. This customized form causes problems when using programs that
need to use Word's default dialog box (for instance Adobe Acrobat). We are
also using a DMS, Interwoven 8.1. My question is how can we avoid using a
customized print dialog box, but still prompt to include a footer and/or not
to bill the print job when printing? Thank you in advance for any
suggestions you may have. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96683
Path/File access error - why wont it fall into the error trap?
Using MS Word 2003 and MS XP Professional
The following code does not seem to trap the "Path/File access" (error
75) - why would this be? What can I do to trap file open errors or
alternatively catch badly formed file names?
On Error GoTo badfile:
If FileThere(sourcefile) Then
Open sourcefile For Binary Access Read As #8
Else
GoTo badfile:
End If
Function FileThere(FileName As String) As Boolean
FileThere = (Dir(FileName) > "")
End Function
The form of the file that it is trying to open is;
X:\B\Big BearAssn\Billings\1234567-Bear Fund $1500 Jun 06 (2).doc
Thanks for your help - this is driving me squirly Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96672
Adding buttons from a macro
Is it possible to add buttons to a custom toolbar from a macro?
Thanks,
Flint Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96666
Deletion of date info in Word comments
(I tried to post this question but it did not seem to work). I like to use
word to mimic HTML web documents with Word screen tips mimicking HTML title
attribute comments, but I can not get rid of the date from the comment. I can
get rid of the author in the comment by changing the author in the document
to " ". I might also like to be able to control the word data that appears in
the screen tips for links in word. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96665
Delete date & other Word provided data from Comments and screen ti
I like to use word screen tips to mimic web page HTML <span...
title="comment....whatever">. However I would like to know how to get rid of
the date that word insists on providing. (I can get rid of the author by
changing the author in the document settings to " ".) I would also like to
get rid of the word provided details from the screen tips that I get from my
links in word. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96664
Inserting text into protected field/textbox
Hi,
I have a letter with fields, which is protected. For the content of
the letter, I want to use variable text.
I made a userform which can select several textlines, which then are
to be inserted in the letter.
The textlines are in separate word-files.
What I want to do is insert a or multiple word-file(s) into a field.
If I unprotect the letter, then the field is overwritten. Is it
possible to insert the text, which is in another file into a protected
field?
Or insert the text and put a field on top of the text?
Thanks, Mike Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96661
Compress Pictures
Is there a way to have VBA macro compress pictures?
If I use CommandBars.FindControl(Id:=6382).Execute the dialog box pops up.
I want to be able to do the whole compression in the macro without a dialog
box popping up.
Is there any way to do that?
Gerald Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96658
Switch function, If Then, or Select Case? (or something else?)
I need to write a function which checks for certain strings in a field, then
reports back a "field type" (my term, not the actual fieldtype in Word) based
on the strings it finds. I don't know quite how to write this. Here's what I
have so far:
Function FieldType(oField As Field) As String
FieldType = Switch((InStr(oField.Code, "mNL1")), "mNL1", (InStr(oField.Code,
"mNLa")), "mNLa", _
(InStr(oField.Code, "MACROBUTTON")), "TypeHere")
End Function
The problem is that if none of the expressions in the Switch function are
true, there's an error. I'd like to add an "OTHER" string that the function
would produce if the field it checks isn't any of my "types" (mNL1, mNLa, and
TypeHere). How would I do that?
Should I be using something other than the Switch function? I thought of
using a Select Case statement, but I'm not sure how to phrase the InStr
checks as a single expression that could be evaluated for each case.
I feel like the answer is staring me in the face, but I'm not familiar
enough with programming to know what I should do. Thanks for any advice you
can give me! Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96651
Finding information related to headings
I have hundreds of legacy documents that I need to add to a index database. I
am looking for a way within Word to search on Criteria such as Author,
creation data, update date , doument revison etc. The intention is to put a
block of files in a dedicated directory, run a routine containing a list of
criteria such as above. Ideally the results which would be reported back on
each document should give any information held in the document against each
criteria, i.e. Author would indicate a name that would be written to a file
that could be imported into Excel and then indexed . Any help on this would
be greatly appreciated as at present I have no idea and am doing the search
manually. Regards Bill Warden Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96645
MsBox showing all the headings of each section
Dear Experts:
I am trying to write a macro that shows me all the headings of all the
sections in a MessageBox, i.e the text from the first paragraph of
each section along with the section number should appear in a Message
Box:
Example:
Section 1: Cover Sheet
Section 2: Acknowledgments
Seciont 3: Contents
Section 4: Preface
Section 5: Chapter 1
Section 6: Chapter 2
etc.
I was able to write part of the macro, ie. loop through all the
sections and get the text from the first paragraph of each section.
But there it ends. Could anybody please give me a hand. Thank you very
much in advance.
Sub ShowSectionHeadings()
Dim rng As Range
Dim sect As Section
Dim strSectionHeading As String
For Each sect In ActiveDocument.Sections
'Get text from first paragraph in section
strSectionHeading = sect.Range.Paragraphs(1).Range.Text
'Trim paragraph mark if present
If Right(strSectionHeading, 1) = vbCr Then
strSectionHeading = Left(strSectionHeading, Len(strSectionHeading)
- 1)
End If
Next sect
End Sub Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96643
Formatting text in Footer?
I have some vba code that I use to update my footer from a userform.
It all works as I have coded it but I am having trouble formatting the
footer text after I update it. For example on my first bookmark I
want it to be left justified and my page x of y that is already in the
footer, I want it right justified. Any ideas?
Thanks! Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96638
AutoOpen macros and the startup folder
In Word 2007, if I want to put all my macros in "AllMacros.dot" and run some
from Normal.dot's AutoOpen macro, how do I get around the fact that the
AllMacros.dot might not be open in time?
(I'm trying to stay compatible with word 2003 so I don't want to use ribbon
stuff. These macros add CommandBar's that I want available in all documents)
If I put "Application.Run "AllMacros.Module1.MyMacro"" in Normal.dot's
AutoOpen it works if I open word (to a blank document) and then open a
document.
But if I run "winword myfile.doc" from the command line, it fails because
Normal.dot's AutoOpen seems to be run BEFORE AllMacros.dot is loaded from the
startup folder. How can I handle this case?
(AutoOpen from AllMacros is not run for all documents so this isn't an
option).
Thank you. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96635
Setting a character style
I am creating Word documents from an Access database and I am trying to
insert two fields into one line so I thought I could do it with a character
style (NormalBold) but the paragraph style is overriding it
My code is
rngWord.Collapse wdCollapseEnd
With rngWord
.Style = "NormalBold"
.InsertAfter "Tel: " & rs!Clubphone
End With
rngWord.Collapse wdCollapseEnd
With rngWord
.Style = "Normal"
.InsertAfter vbTab
If Not IsNull(rs!Clubfax) Then
.InsertAfter "Fax: " & rs!Clubfax & vbCrLf
Else
.InsertAfter vbCrLf
End If
Any ideas please
--
Regards
Stephen English Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96628
Limit variable to text/number
I have some code that asks the user for information on a template:
Dim ACCTSSN As Integer
ACCTSSN = InputBox("Enter Borrower's SSN (123456789)", "SSN")
I check the value to make sure they put in 9 characters:
If Len(Trim(ACCTSSN)) <> 9 Then
ERROR = MsgBox("SSN must be 9 digits", vbOKOnly, "SSN Error")
GoSub SUB_GET_ACCTSSN
End If
Now how do I make sure they don't put in text/special characters? I
initially had the field set as a string, but thought that making it an
integer would prevent the field from accepting letters. It does accept
letters and gives me an error when I click OK on the box.
I also have other input boxes that I'm going to want to check to see if the
user put in a valid date format (00/00/00 or 00/00/0000 or 0/0/0000).
How can I check a variable to see if it's got the right format, or limit the
variable so you can't put an invalid value in it while using an input box to
obtain the value?
THX! Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96622
macro for applying one Style conditional on another Style
I'm trying to create a macro that will do the following:
Let's say I had a table and I applied a certain Style to one of its cells.
I would like for Word to automatically apply a different Style to its
neighboring cell when I tab over. I'm basically trying to translate the
conditional, "If I use Style X in a cell, apply Style Y in the cell to the
right. Otherwise, keep the Style in the cell to the right as Normal." into a
macro. I would appreciate any hints or even websites that will help me do
this. Thanks! Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96619
Making a form field required
First of all, I have a form with several fields. Several of the fields are
drop down boxes.
1. Can I make these fields required (and how do I do it)
2. If I'm already using all 25 items for the list, can I make sure none are
set as the default and/or how could I tell that they had actually made a
selection and not just accepted the default?
Thanks much Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96618
Numbered Documents - Protected Forms
I am trying to created a form template (.dot) that has an invoice number that
automatically updates (+1) each time the template is used to created a new
document.
I found the following script for a macro that works great until I protect
the form. Then I get an error because the macro can't update a protected
area. I can't figure out how to "unprotect" the bookmark on the page so it
can update. Any ideas?
Sub AutoNew()
Order = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order
ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Date, "yymmdd" &
"-") & Format(Order, "00#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "00#")
End Sub Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96612
Automating charts in word
Is it possible to automatically update charts within a word document from a
data source and thus create automated reports? I want to create several
research reports which will contain around 10 charts (e.g. excel bar charts).
The data will be in one source and will contain flags for sector. Each sector
will get a seperate report. I want to create it in word so that I can easily
add text to form a story around the charts. The text will not be generated
automatically and may be of different lengths depending on the results.
Any suggestions would be appreciated, thanks. Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96609
merging with query in access 2003
Hi,
I would like to automate merging between word and access 2003. I had code
that worked in 2000, but now I'm getting error messages.
Thanks.
jbc Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96603
Deleting a graphic in a Header
Hello,
I have the following code that needs to go into the Header, go to the
bookmark which is a graphic that I created a bookmark for, and then delete
the graphic. When I do it manually it works fine but the macro returns an
error that says it cannot find the bookmark. What am I doing wrong?? Thanks
for any suggestions:
Selection.HomeKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.GoTo What:=wdGoToBookmark, Name:="bkLogo"
Selection.ShapeRange.Delete
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument Tag: How to calculate Division of Marks in Table of MS Word? Tag: 96602