Calculations In Access
Trying to make a calculation in Microsoft Access that would allow m
to take the currency in one field, and multiply it by the quantity o
an item in another field and place this calculated information in
new field Tag: re:Macro that Prompts user to print. Tag: 67496
Can I disable the "activate macros" prompt?
I have a document that contains macros that I want to distribute to
large user base. Is there any way to override the "activate macros
prompt or do I need to talk them through setting their macro securit
to "medium" and then activate macros everytime they open th
document
If the latter is the case, is there I way I can check to see if the
have activated the macros, i.e. to flag to them that the macro
aren't activated and what they need to do to activate
Thanks Tag: re:Macro that Prompts user to print. Tag: 67495
Date Problem using mail merge.
I have specified in my Access database that I want my date format t
be a medium date with the following layout
19-Mar-0
This would display fine and to the exact format in Access, but when
pull it into a mail merge in Word, the format changes to: 3/19/0
Is there anyway that I can make it display like 19-Mar-04?
Another problem I am having in access is I have a field called "Mus
Use By:" where a user must manually enter a date on an item. The dat
can be any time from now or till 2 years in advanced, How do I mak
that field so that a user can manually enter that date easily? Not b
having to type 16-Mar-04. I would like an easier approach.
Thank You Tag: re:Macro that Prompts user to print. Tag: 67494
Access password makes word mail merge error
Everytime I open an access database exclusively and set a password, o
add a password to a workgroup, the mail merge document that is usin
the database tells me that the operations of the database are corrup
and I have to go manually and search for a new database.
Any ideas how I can protect my database and STILL pull information t
the word document for mail merge Tag: re:Macro that Prompts user to print. Tag: 67493
Macro that Prompts user to print.
Hey All.
I have made a document that has 8 (eight) labels to ONE page. Th
document is divided into 4 rows by 2 coloumns. Each label goes into
cell of its own
I have made 7 macros so that a user can choose to print any amount o
labels from 1-8 by just pressing any of the short cut keys
The first macro is shift+F7 which would delete one of the first label
and then print the other 7
The second macro is shift+F6 which would delte the first two label
and continue to print the other 6. And so on..
This is all well and good. If a user wants to print 8, he needs to d
nothing but print the document as it is, because it is at default,
labels
The challenge lies where I want a user to get a prompt when they pres
print, whcih would have a box appear and say
"how many would you like to print?
the user then could input the amount they wish to print and the macr
automatically interprets that amount and prints that exact amount
So if a user wanted to print 9 labels, it would print ONE full shee
of 8 and then on another sheet, it shall only print 1
Is there anyone out there that can do this? If you need more info t
make the situation clear, just let me know. Thank You Tag: re:Macro that Prompts user to print. Tag: 67492
odd symbols when I email to my editor
I am using Microsoft Word - text Times New Roman - which is set standard on
my computer and when I us the symbols ", ', ), (, " each on of the items
comes out as just a bunch of symbols and it's getting frustraing . They said
eithrer fix the problem or work elsewere....help? Tag: re:Macro that Prompts user to print. Tag: 67490
FAQ - vba - Frequently Asked Questions - please read before posting - unofficial May posting
FAQ = Frequently Asked Questions - brief - vba - unofficial
This FAQ is posted weekly.- more or less
Please save us all some time by reading it before posting to the
news group.
This newsgroup is about VBA - Visual Basic for Applications -
which is the programming language for Word 97-2003 (macros).
There is a longer FAQ with more questions and links that is
regularly posted in the non-VBA Word newsgroups. You may want
to check that out as well.
--- BEFORE POSTING ANYTHING PLEASE READ THESE ---
http://www.mvps.org/word/FindHelp/Posting.htm
http://www.dts-l.org/goodpost.htm
Reading these articles will help you get a quick and meaningful
response to your question rather than just more questions for you.
It may keep your message from being screened or bounced.
A few basics, though:
(1) Be nice; everyone answering questions here is a volunteer.
(2) Post a question in only one newsgroup generally. If you
_have to_ post in more than one, post a _single_ message and
put both newsgroups in the header for that _single_ message.
(3) Do not attach anything to a message.
(4) The only really stupid question is the one you don't ask.
(5) Do not use your real email address unless you want spam.
(See bottom for sample.)
The reasons for the requests are spelled out on the web page.
A longer version of this FAQ is also on the Internet at
http://addbalance.com/word/index.htm
Newsgroup Archives:
http://groups.google.com/advanced_group_search
MVPs FAQ site: http://www.mvps.org/word/ To the extent
there is any "official" FAQ, this is it.
---
Also, before posting, you may want to look at the following
questions to see if yours is among them.
---------- ---------- ---------- ---------- ---------- ----------
1. I see a macro in a newsgroup I would like to try. How
do I add it to my template?
http://addbalance.com/word/macrosfromnewsgroup.htm or
http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm
2. What are some good books for me to read about Word?
http://addbalance.com/word/wordbooks.htm and
http://www.mvps.org/word/Tutorials/BookRecommendations.htm
3. How can I run a macro automatically when a document opens,
closes, is created?
http://www.mvps.org/word/FAQs/MacrosVBA/DocumentEvents.htm
4. How can I distribute or backup macros / customizations?
http://word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm
http://addbalance.com/word/movetotemplate.htm
5. What is an MVP?
http://www.mvps.org/word/AboutMVPs/index.html and
http://addbalance.com/word/mvp.htm
6. I need to make a form to...
Userforms are custom dialog boxes written using vba.
If you want a fill-in-the-blanks form you want what Word
calls an online form. Look in Word's help for that,
and for more info on online forms follow the links at:
http://addbalance.com/word/wordwebresources.htm#Forms
especially Dian Chapman's series of articles
If you want a custom dialog box that you code with VBA commands
you want a UserForm. Take a look at:
http://www.mvps.org/word/FAQs/Userforms.htm
7. Where can I find more information on the Web?
http://addbalance.com/word/wordwebresources.htm#webvba
http://www.mvps.org/word/FAQs/MacrosVBA.htm
http://www.mvps.org/word/FAQs/Userforms.htm
http://www.mvps.org/word/FAQs/Customization.htm
http://www.mvps.org/word/FAQs/OfficeInterdev.htm
Comments / corrections / additions may be sent to
wordfaq@no.spam.addbalance.com. Remove no.spam from the
address. (This is a "proofed" email address, I hope.)
Posted 1 May 2005
Charles Kenyon (the editor) Tag: re:Macro that Prompts user to print. Tag: 67487
Open a web page in Word
Can I use VBA in Word to open a web page on a web server?
I can use followhyperlink to open a HTML file on the local system but if
this is used for a file on a web server it opens the file in a new Browser
window
---
haddress = "file:///" & fname & ".htm"
ActiveDocument.FollowHyperlink haddress
Grateful for any assistance,
Peter E Tag: re:Macro that Prompts user to print. Tag: 67479
easy install of template (saveas fileformat:=WDformattempate) ERRO
Hello everyone,
I am working on distributing a VBA utility an want to distribute in the
easest possible way for people to install and use.
I would like to distribute it as a single Word .DOC file that will contain
both the documentation and the VBA. The document will contain buttons to
install the code in the .../WORD/STARTUP folder and also uninstall it. The
utilility will be launched by a toolbar button.
The fall back method (which is working) to distribute it as a .DOC (with
document and Install button) and a seperate .DOT file.
The install code is given below but there is a problem (isn't there always).
1. It will run correctly if I click the RUN button in the VBA editor but if
I click a button in the document I get a "Runtime eror 4198. Cpommand failed"
2. Sometimes, when Word is restarted I get a message saying that the
template in the STARTUP folder is "not valid"
Does anyone have any suggestions on how to get around this problem so I
distribute a single file.
Thanks in anticipation of receiving lots of helpful suggestions,
Peter
http://members.dodo.com.au/bakerevans/
------
Sub install()
Dim destfile As String
Dim sourceFile As String
Dim thisfile As String
Dim theMessage
theMessage = "Do you want to install Word Purge?" & vbCrLf
If MsgBox(theMessage, vbYesNo) = vbYes Then
'name of this file
thisfile = Application.ActiveDocument.FullName
destfile = Options.DefaultFilePath(wdStartupPath) & _
Application.PathSeparator & "Word Purge.dot"
sourceFile = Application.ActiveDocument.Path & _
Application.PathSeparator & "Word Purge.dot"
ActiveDocument.SaveAs FileName:=destfile, _
FileFormat:=wdFormatTemplate
End If
end sub Tag: re:Macro that Prompts user to print. Tag: 67478
simple install a template (saveas fileformat:=wdformattemplate) ER
Hello everyone,
I am working on distributing a VBA utility an want to distribute in the
easest possible way for people to install and use.
I would like to distribute it as a single Word .DOC file that will contain
both the documentation and the VBA. The document will contain buttons to
install the code in the .../WORD/STARTUP folder and also uninstall it. The
utilility will be launched by a toolbar button.
The fall back method (which is working) to distribute it as a .DOC (with
document and Install button) and a seperate .DOT file.
The install code is given below but there is a problem (isn't there always).
1. It will run correctly if I click the RUN button in the VBA editor but if
I click a button in the document I get a "Runtime eror 4198. Cpommand failed"
2. Sometimes, when Word is restarted I get a message saying that the
template in the STARTUP folder is "not valid"
Does anyone have any suggestions on how to get around this problem so I
distribute a single file.
Thanks in anticipation of receiving lots of helpful suggestions,
Peter
http://members.dodo.com.au/bakerevans/
------
Sub install()
Dim destfile As String
Dim sourceFile As String
Dim thisfile As String
Dim theMessage
theMessage = "Do you want to install Word Purge?" & vbCrLf
If MsgBox(theMessage, vbYesNo) = vbYes Then
'name of this file
thisfile = Application.ActiveDocument.FullName
destfile = Options.DefaultFilePath(wdStartupPath) & _
Application.PathSeparator & "Word Purge.dot"
sourceFile = Application.ActiveDocument.Path & _
Application.PathSeparator & "Word Purge.dot"
ActiveDocument.SaveAs FileName:=destfile, _
FileFormat:=wdFormatTemplate
End If
end sub Tag: re:Macro that Prompts user to print. Tag: 67477
Change Sentence Case
Hi,
I am trying to write a macro that will change the case of all titles to
Sentence case. All titles are paragraphs that are bolded. Below is my code,
but it doesn't work. Any help would be appreciated. Thank you!
Sub TitleToSentCase()
Dim r As Range
Set r = ActiveDocument.Range
With r.Find
.Text = "(^013)"
.Font.Bold = True
.MatchWildcards = True
. Execute
Do While .Found
r.Case = wdTitleSentence
Loop
End With
End Sub Tag: re:Macro that Prompts user to print. Tag: 67473
Wildcards
Hi,
Can someone tell me what I am doing wrong here. I am trying to find all
instances of the following in my document:
Appendix 3
Appendix 7.6
Appendix 8.8.9.9.9
etc
I want to find using 1 expression. This is what I am using :
(Appendix)([0-9|.| ]@{1,}) and it works fine but doesn't pick all of them.
For example: I have Appendix 8.1.3, Appendix 8.1.4, Appendix 8.1.5, Appendix
8.1.6 So it picks up the first 2, skips the 3rd one and finds the 4th one...I
don't understand why it does that? Can someone help me.
Thank you in Advance.
~ mehj Tag: re:Macro that Prompts user to print. Tag: 67465
autotext and tables
I use a form to insert autotext into a doc. This particular autotext is in
tabular format. My problem is that some of the rows when inserted will span
multiple pages and the next row down will start after. (Which is a good
thing) However some of the rows, when inserted will span multiple pages and
then force a page break before the next row starts.
I hope the above makes sense. Any ideas on how I can force the rows/cells to
stay together? Whether it be some clean-up code or on insertion into the doc.
Thanks,
Dave Tag: re:Macro that Prompts user to print. Tag: 67461
Setting VBA Project Password
Here's what I ended up with.
It was a difficult birth.
http://www.standards.com/index.html?SetVBAProjectPassword Tag: re:Macro that Prompts user to print. Tag: 67458
How can I create a library for Word VBA?
Hi All,
How can I create a library for Word(97 or later version) VBA?
Is there any web site talk about this?
Thanks
Regards Tag: re:Macro that Prompts user to print. Tag: 67456
Word Clipboard Full
My Clipboard is full - 24 items. I cannot clip any more and I cannot delete
any of these. I am an experienced user so don't want the usual suggestions. I
do know my way around Word.
Thanks a lot
Charles Tag: re:Macro that Prompts user to print. Tag: 67446
Nested Tables
Helmut/JGM
The other day the three of us where looking at the problem of drilling down
to "deep" nested tables. Cindy Meister "shoved" me twice in the right
direction and I think I have finally put together some code that will delete
"ALL" empty paragraphs in a document. Cindy, if you are reading, thanks
again!! The code is probably inefficient and ugly, but I haven't been able
to break it in over a half hour of trying. The code as part of the complete
Add in is available here in you care to have a look.
http://gregmaxey.mvps.org/Clean_Up_Text.htm
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word. Tag: re:Macro that Prompts user to print. Tag: 67441
Disable form field using VBA
Using Word 2002, is there a method to uncheck 'fill-in enabled' using VBA?
For example, on exit of each checkbox in a group, determines if one is
selected and then disables several other fields (so that tab moves to the
next group).
TIA,
Mike Tag: re:Macro that Prompts user to print. Tag: 67436
Msbbox - VBok for empty text boxes
Hello,
Created a template with a user form to collect information. Form text and
combo boxes drop information into bookmarks. Everything here works fine.
I have had no success in completing code to get a general message box to
display if any of the text or combo boxes have been left blank when the user
clicks the submit button.
I would like the user to receive the msg. and click OK to return to the from
I am placing my attempt in the cmdSubmit_Click()
Still new to VBA...
--
Thank-you and all suggestions are appreciated. Tag: re:Macro that Prompts user to print. Tag: 67429
Error 5102
I am opening a new document based on a template from Access. When I move to
the 2nd bookmark, it gives me "Error 5102: You entered multiple destinations
for a page, line, footnote, endnote, or comment." The bookmark is on the
template and I checked spelling, etc. but have no idea what is causing. Can
anyone shed some light on this? Thanks.
David Tag: re:Macro that Prompts user to print. Tag: 67427
Get a cell value from excel
Hi,
Firs of all, thank you for reeding my question. I would like to get a cell
value from a excel file into a word file, using macros programming. I mean,
developing a macro able to read a cell.
Thanks Tag: re:Macro that Prompts user to print. Tag: 67423
DATES
I have a form in Word which needs to be 2-sided when printed and contain
calendar dates - one for each day - to be filled in by hand by people without
computer access. Preferable format "Friday, April 29, 2005. Can be moved to
Excel. Any help is greatly appreciated. Tag: re:Macro that Prompts user to print. Tag: 67418
Copy text to XML element
I open a Word doc based on a template. In
the template I have attached a schema and added some elements to the doc,
one of which is called "FirstName.". What I am trying to do is set the value
of the FirstName element to some text. I have tried several techniques such
as
dim wdApp as New Word.Application
dim wdDoc as New Word.Document
dim wdTemp = "C:\MyTemplate.dot"
dim wdNode as Word.XMLNode
wdDoc = wdApp.Documents.Add(wdTemp)
wdNode = wdDoc.SelectSingleNode("/FirstName")
wdNode.Text = "Nancy"
when I do this, I get error msg 'object reference not set to an instance of
an object" telling me that '/FirstName" is not a valid XPath, I think. I
then try
wdNode = wdDoc.SelectSingleNode("FirstName")
wdNode = "Nancy"
and get the same error.
My question is how can I set the value of an XML element in a doc to a text
value at run time? Thanks for your help Tag: re:Macro that Prompts user to print. Tag: 67417
html
Hello,
I have a word document with a lot of html links. How can I download
automatically all the html files of those links?
Bye.
Marcel Tag: re:Macro that Prompts user to print. Tag: 67416
hyperlink; read-only
I am trying to find out if it is possible to change the settings of a
hyperlink so that a document will be opened as "Read-only". Thanks! Tag: re:Macro that Prompts user to print. Tag: 67414
Opening webpage from vba without opening new IE window
I can open a webpage from vba a couple of different ways:
pAddress = "C:\Program Files\Internet Explorer\IEXPLORE.EXE " & sAddress
Shell pAddress, vbNormalFocus
Shell ("C:\Program Files\Internet Explorer\IEXPLORE.EXE _
www.washingtonpost.com"), vbNormalFocus
But these open a new IE window each time. Is it possible to load a
webpage into an existing IE window, without open a new IE window?
Thanks,
Larry Tag: re:Macro that Prompts user to print. Tag: 67411
VBA question, can't get this macro to work
i can't get the replacement text area to work. It finds the right
information, but i can't get the insert section break to work. PLEASE
HELP!!!!
With Selection.Find
.Text = " APR 1-2005 "
.Replacement.Text = Selection.InsertBreak wdSectionBreakNextPage & "
APR 1-2005 "
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With Tag: re:Macro that Prompts user to print. Tag: 67410
Storing Child word documents inside Master documents using Word's document objects.
Hi All,
I am trying to store a word(Child) document inside another word document
(Master) in such a way that the Child document can't be seen when the Master
is opened (Master and Child will be inside a single file). By default, when
the document is opened, the Master document is shown. The Child will be
shown when I click my Active X's "show child document" menu item. To achieve
this I tried to store the Child document inside my ActiveX but quickly found
that I can't store more than approx 200KB (I may be wrong in the exact size)
of Child document. I then tried to store the Child document inside Document
variable of Master Doc. The Document variable is hidden so seemed OK. I
broke my Child document in chunks of 100 KB and stored in recognizable
Document variables of Master document Object. So far so good. I tried this
on Windows 2000 Server with Office 2003 and it worked but on Windows XP
after creating 2 such Document variables containing the Child documents it
started giving strange data e.g. If the Child document size is 60 KB whle
storing, on retrieving I get 100 KB!! which then crashes by application
while checking. This is only happening in Windows XP Home Edition and
Professional.
Now questions;
1) Is there any other way to store word document inside a word document
programmatically ?
2) Any reason why is it failing to give me the correct data?
3) On programmaticall removal of the document variables, the size of the
Master document remains the same, why ?
Thanks for reading..
Regards,
Wahaj Tag: re:Macro that Prompts user to print. Tag: 67409
AutoExec macro in Word project won't run when Outlook is running
I have an AutoExec macro in a '.dot' project saved in the StartUp folder. It
is supposed to run everytime I run Word. It does, except that if I have
previously started Outlook (with Word selected as Outlooks e-mail editor),
the AutoExec will not automatically run. Why? How can I get the AutoExec
macro to run regardless of Outlooks presence.
Thanks.
Ed Tag: re:Macro that Prompts user to print. Tag: 67405
"Getting rid" of tem,plate information
I have a document, based on a certain template. This template is placed on a
server.
When I mail documents based on this template to customers, and they try to
open the document, Word starts searching for the template in the customers.
It takes a long time, and only when Word "are sure" the template is not
there, it opens the document. This is annoying to my customers.
Is there anyway I can remove the connection between document and template,
before mailing the document, maybe using Document_Close() or someting like
that.?
Jan Tag: re:Macro that Prompts user to print. Tag: 67403
thezaurus for English Language
How can I get a thezaurus for English Language to use it in Word? I do not
have it, because I use a Polish version of Office Package. Thank you Tag: re:Macro that Prompts user to print. Tag: 67402
Deleting text in bookmarks very slow...
Hello,
I've run into a problem in my C# add-in for Word.
One of the operations that the add-in has to do is going over all =
bookmarks in a document and removing the bookmarks and its content if =
certain conditions are true.
Originally, I tried the following:
bookmark.Range.Text =3D "";
Unfortunately, it did not work correctly in all cases (for example, if =
the bookmark spanned table cells).
So I used the following:
Microsoft.Office.Interop.Word.Range range =3D bookmark.Range;
bookmark.Delete();
range.Delete(ref missing, ref missing);
when "missing" was initialized thus:
object missing =3D System.Reflection.Type.Missing;
That works correctly but, according to the profiler, is 4-5 times =
slower!
Since this operation is performed in a tight loop, on a document with a =
lot of bookmarks that need to be deleted, this slowdown is VERY =
noticeable.
The breakdown of the timing between the 3 lines is roughly:
Microsoft.Office.Interop.Word.Range range =3D bookmark.Range; // =
3.6%
bookmark.Delete(); // 13.8%
range.Delete(ref missing, ref missing); // 82.6%
So the culprit is the range.Delete() operation.
I really need to speed this up!
Any help is appreciated.
Thanks,
Alex.
--=20
Address email to user "response" at domain "alexoren" with suffix "com" Tag: re:Macro that Prompts user to print. Tag: 67397
How I can change the default font size in normal.dot via VBA
Hi There I need to change the default font from Times New Roman 12 pt to
Times New Roman 11 pt in Normal.dot. I know how do to that manually but I
need to change the font by VBA in a master template and then update all the
users Normal.dots by pushing out the master template. would you please let me
know what I'm doing wrong in below code any help would be appreciated.
Many Thanks,
Leila
Sub AutoExec()
'
'
'
Font
End Sub
--------------------
Sub Font()
With ActiveDocument.AttachedTemplate.Styles("Normal").Font
.Name = "Times New Roman"
.Size = 11
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Scaling = 100
.Kerning = 0
.Animation = wdAnimationNone
End With
'Selection.Style = ActiveDocument.Styles("Normal")
End Sub Tag: re:Macro that Prompts user to print. Tag: 67393
hyperlink shortcut file
In Word 2002, I am hyperlinking to the web, our network and to internal
bookmarks. To access our network, I have to set the hyperlink base for the
document to file://c:\ which then messes up the internal links. It was
suggested that I create a shortcut file to link to and the shortcut file than
access the network. Fine but the process has to be seamless to the user. Do
I need VB or VBA to do this? I don't either so this will be a problem. Any
help is greatly appreicated.
Redbird Tag: re:Macro that Prompts user to print. Tag: 67392
How do I insert a drop down menu in a document header?
I am creating a template using Word. I need to insert a drop down menu in
the document Header. I can not add a drop down menu to the header. Tag: re:Macro that Prompts user to print. Tag: 67387
Square Boxes
I wrote some code in excel that would take cell values and write it to the
appropriate form field in word. I have vbcrlf but when it gets to word i get
two square boxes instead. Does anyone have a work around?
Anthony Tag: re:Macro that Prompts user to print. Tag: 67384
number of lines a cell
What method would I use to calculate the number of lines in a cell within a
table programmatically? Tag: re:Macro that Prompts user to print. Tag: 67383
Find 2 lines of text, not one
what do i use to find two lines of text. I am searching through a 10,000
page file that is a billing file. the only thing that specifies a change in
bills is two lines. So i haev to find two lines of text, then replace those
two lines with themselves, plus a section break before the two lines. Tag: re:Macro that Prompts user to print. Tag: 67382
Document Protection - Editing Restrictions
I set up a fill-form template in Word 2003. When I tried to set editing
restrictions for users to only enter in data fields I set up, the whole
window was "grayed out" so that I couldn't make any selections.
How can I change this to be normal, useable? Tag: re:Macro that Prompts user to print. Tag: 67378
Clearing Whitespace after a bookmark
Hello All,
I have a bookmark at the end of template called End. I'd like to be able to
programatically get rid of any extra whitespace or unessary pages after this
bookmark using a macro.
Any suggestions? Any help would be greatly appreciated.
Thanks,
dave Tag: re:Macro that Prompts user to print. Tag: 67376
How to increase a text form field size
I am creating a form in Word. The shaded box is small in length. Although
the size is set to unlimited, when the user types something in the box you
cannot see everything the user types.
How can I set the form field properties so if a person wanted to type
something like (like an address), they can see everything they have typed in
the field? Tag: re:Macro that Prompts user to print. Tag: 67373
Linking check boxes
I have a form with two lists of checkboxes. Some checkboxes from list A
should automatically choose a particular checkbox from list B. So, for
instance, if any one of checkboxes 1, 3, 5, or 7 is checked, then checkbox 10
should also be checked. Only one of 1, 3, 5, or 7 will be checked at any
one time, all others will be unchecked.
I found the following code in the newsgroups that will work for a making one
checkbox automatically check a second one. (Thanks!) This could work in my
situation, but I would have to use separate macros for each of my checkboxes.
I am wondering if there is a way to put all into one macro.
Sub SetCheckboxes()
ActiveDocument.FormFields("Check2").CheckBox.Value _
= ActiveDocument.FormFields("Check1").CheckBox.Value
End Sub
Thanks for any ideas anyone can give me! Tag: re:Macro that Prompts user to print. Tag: 67368
setting ExitMacro (to template)
Okay, get a load of this:
I am trying to check code using an attached template, and after I perfect
the code, make the attached template a workgroup template. I hope that's
proper.
So, I name the template "Forms.dot" and make it an attached template. (When
"Forms.dot" is my "Normal.dot", the code works perfectly.)
Now, as an attached template (with a blank Normal.dot), the code errors out
at the following code:
ActiveDocument.FormFields(4).ExitMacro = "doCopies"
"doCopies" is a sub within the attached template "Forms.dot", which is where
the code errors. I shouldn't have to refer to the module or project if it's
in the same routine, should I? When I halt the code, and manually go to the
document, I can manually "see" the sub "doCopies", so it's available, but
still my code errors.
Anyway, I can't get past this. Can anyone offer some help?
TIA Tag: re:Macro that Prompts user to print. Tag: 67363
How do I eliminate auto text when I open word?
I need assistance. When I open a Word document, there is text already
printed along with a font size. Tag: re:Macro that Prompts user to print. Tag: 67358
setting XML elements in Word doc to text
Hi,
From VSTO in Visual Studio.NET, I open a Word doc based on a template. In
the template I have attached a schema and added some elements to the doc,
one of which is called "FirstName.". What I am trying to do is set the value
of the FirstName element to some text. I have tried several techniques such
as
dim wdApp as New Word.Application
dim wdDoc as New Word.Document
dim wdTemp = "C:\MyTemplate.dot"
dim wdNode as Word.XMLNode
wdDoc = wdApp.Documents.Add(wdTemp)
wdNode = wdDoc.SelectSingleNode("/FirstName")
wdNode.Text = "Nancy"
when I do this, I get error msg 'object reference not set to an instance of
an object" telling me that '/FirstName" is not a valid XPath, I think. I
then try
wdNode = wdDoc.SelectSingleNode("FirstName")
wdNode = "Nancy"
and get the same error.
My question is how can I set the value of an XML element in a doc to a text
value at run time? Thanks for your help. Tag: re:Macro that Prompts user to print. Tag: 67357
setting XML elements in Word doc to text
Hi,
From VSTO in Visual Studio.NET, I open a Word doc based on a template. In
the template I have attached a schema and added some elements to the doc,
one of which is called "FirstName.". What I am trying to do is set the value
of the FirstName element to some text. I have tried several techniques such
as
dim wdApp as New Word.Application
dim wdDoc as New Word.Document
dim wdTemp = "C:\MyTemplate.dot"
dim wdNode as Word.XMLNode
wdDoc = wdApp.Documents.Add(wdTemp)
wdNode = wdDoc.SelectSingleNode("/FirstName")
wdNode.Text = "Nancy"
when I do this, I get error msg 'object reference not set to an instance of
an object" telling me that '/FirstName" is not a valid XPath, I think. I
then try
wdNode = wdDoc.SelectSingleNode("FirstName")
wdNode = "Nancy"
and get the same error.
My question is how can I set the value of an XML element in a doc to a text
value at run time? Thanks for your help. Tag: re:Macro that Prompts user to print. Tag: 67356
setting XML elements in Word doc to text
Hi,
From VSTO in Visual Studio.NET, I open a Word doc based on a template. In
the template I have attached a schema and added some elements to the doc,
one of which is called "FirstName.". What I am trying to do is set the value
of the FirstName element to some text. I have tried several techniques such
as
dim wdApp as New Word.Application
dim wdDoc as New Word.Document
dim wdTemp = "C:\MyTemplate.dot"
dim wdNode as Word.XMLNode
wdDoc = wdApp.Documents.Add(wdTemp)
wdNode = wdDoc.SelectSingleNode("/FirstName")
wdNode.Text = "Nancy"
when I do this, I get error msg 'object reference not set to an instance of
an object" telling me that '/FirstName" is not a valid XPath, I think. I
then try
wdNode = wdDoc.SelectSingleNode("FirstName")
wdNode = "Nancy"
and get the same error.
My question is how can I set the value of an XML element in a doc to a text
value at run time? Thanks for your help. Tag: re:Macro that Prompts user to print. Tag: 67355
Any way to have Dialog(wdDialogEditReplace) function like interactive Replace Dialog
Folks,
I want to have the Replace dialog displayed with parameters drawn from a
text file in which the lines have the format "Findstring=ReplaceString".
E.g., an entry of "1=2" would populate the find field of the dialog with "1"
and the replace field with "2". The code below more or less works except
that after the user selects "Replace All", the usual prompt indicating that
"X replacements have been made" or "Word has finished searching the
document" does not appear. Thus, it will be a bit disorienting when using
the routine. Am I missing some properties that enable/disable the messages?
Thanks,
Tom
Sub testreadfile()
Dim AStr() As String
Dim SearchStr As String
Dim RplcStr As String
Dim FString As String
Dim DlgFind As Dialog
Dim AString As String
On Error Resume Next
Set DlgFind = Dialogs(wdDialogEditReplace)
FString = "C:\wordmacros\a.txt"
Open FString For Input Access Read As #1
While Not EOF(1)
Line Input #1, AString
If Len(AString) > 0 And Not AString Like "*[=]*" Then
MsgBox AString + " is not a valid entry"
End If
AStr = Split(AString, "=")
SearchStr = Trim(AStr(0))
RplcStr = (AStr(1))
With DlgFind
.Find = SearchStr
.Replace = RplcStr
.Show
End With
Wend
Close #1
End Sub Tag: re:Macro that Prompts user to print. Tag: 67354