automating style formatting
Help! For the first time Iâ??m trying to use the formatting features of Word
2007. I have a 2500 page commentary which Iâ??v cleared of all formatting to
start with. Then I began to define in my mind what is to be defined as
Heading 1, Heading 2, etc. As you might conclude the designation of over
400,000 verses and over 100,000 references etc will take the remainder of my
mortal life. Now I have a project for the first eternity in heaven. Wrong.
I need to use the automated features of Word to help me in the massive
formatting job. I think the key might b in Search and Replace.
How do I use search and replace to change a format a line to Heading 3
TOPIC â?? Redemption See Appendix A
Or a scripture verse to Heading 2
Genesis 4:9 or John 12:5
When there are 66 books and thousands of verses?
Also how can I redefine the format I want as opposed to the preset formats
in Change Style?
Is the tool I need Find and Replace? Tag: greetings!! Tag: 106863
DocumentBeforeClose event not always working
I have a document protected for forms which I will be emailing out. I need
the users to complete one of the fields before closing the document.
Using the Help files, I created a macro to run on the DocumentBeforeClose
event. The Help files stated that you must create a separate Class Module to
post the code in. And it also said to create an event handler macro that
must be run before it will work.
I did these things and the code works after running the event handler macro.
However, do you have to run that macro every time the document is opened?
The code will not execute in subsequent openings of the file, unless the
event handler macro is run again. Isn't there a way to make everything run
smoothly without having to run that macro every time the document is opened?
Here is the code. I have a Class Module called EventClassModule with the
following code (I also have a DocumentOpen event, in the same class module
and having the same issues):
Public WithEvents appWord As Word.Application
-----
Private Sub appWord_DocumentBeforeClose _
(ByVal Doc As Document, _
Cancel As Boolean)
Dim BusJust
If ActiveDocument.FormFields("txt_BusJust").Result = "" Then
MsgBox ("You must complete the" & Chr(10) & "BUSINESS
JUSTIFICATION(S)" & Chr(10) _
& "field before closing this document.")
Cancel = True
ActiveDocument.Bookmarks("txt_BusJust").Select
End If
-----
Private Sub appWord_DocumentOpen(ByVal Doc As Document)
ActiveDocument.ActiveWindow.View.ShowHiddenText = False
End Sub
Then, in the NewMacros module, I have the following code:
Sub Register_Event_Handler()
Set X.appWord = Word.Application
End Sub
Thanks for your help.
Kristi Tag: greetings!! Tag: 106862
What could be wrong ?
Hi all,
Hoping someone may be able to offer some advice.. We were encountering a
problem running our software which calls word via OLE on a clients machine
who happens to have upgraded to word 2007. I use word 2007 and other clients
use Word2007 and the program works fine - so to narrow the problem down I
created a small document with a macro.. all the macro does is set
Application.options.savenormalprompt to false.
Now for some reason on all word 2003 and most word 2007 machines this runs
fine, but on one client it fails with a Bad Parameter message.
Does anyone have any idea where it might be failing on this particular
isntallation ?
Thanks for any thoughts... Tag: greetings!! Tag: 106859
Excel range in SQL line-how to reference
Can anyone tell why the cell range reference in the SQL line will not
run? I'm not sure how to reference cells in the active worksheet in
the SQL.
Any help would be greatly apperciated!
Thanks,
SB
Sub Button1_Click()
' exports data from the active worksheet to a table in an Access
database
' this procedure must be edited before use
Dim db As Database, rs As Recordset, r As Long, strSQL As String
Dim id
Set db = OpenDatabase("\\Rtp-filer02a\wg-c\CandidateTrackingTool
\Private\CTT_v1_be.mdb ")
' open the database
Set rs = db.OpenRecordset("Candidate Evaluation", dbOpenTable)
' get all records in a table
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("CandidateName") = Range("D5").Value
.Fields("School") = Range("D6").Value
.Fields("GradDate") = Range("D7").Value
.Fields("Major") = Range("D8").Value
.Fields("Degree") = Range("D9").Value
.Fields("gpa_4scale") = Range("D10").Value
.Fields("gpa_5scale") = Range("D11").Value
.Fields("Interviewer") = Range("B13").Value
.Fields("evalDate") = Range("H13").Value
.Fields("LocationPref") = Range("A17").Value
.Fields("Type") = Range("E17").Value
.Fields("BU") = Range("A19").Value
.Fields("JobTitle") = Range("B20").Value
.Fields("Uslegal") = Range("B23").Value
.Fields("Sponsorship") = Range("A25").Value
.Fields("legalcountries") = Range("G29").Value
.Fields("Current Immigration") = Range("G34").Value
.Fields("CiscoKnowledge_score") = Range("H41").Value
.Fields("CiscoKnowledge") = Range("F42").Value
.Fields("INITIATIVE_score") = Range("H46").Value
.Fields("INITIATIVE") = Range("F47").Value
.Fields("TECHNICALACUMEN _score") = Range("H51").Value
.Fields("TECHNICALACUMEN") = Range("F52").Value
.Fields("LEADERSHIP_score") = Range("H56").Value
.Fields("LEADERSHIP") = Range("F58").Value
.Fields("team player_score") = Range("H62").Value
.Fields("team player") = Range("F63").Value
.Fields("Communication_score") = Range("H67").Value
.Fields("Communication") = Range("F68").Value
.Fields("OverallAvg") = Range("G73").Value
.Fields("Recommendations") = Range("G74").Value
.Fields("CTT ID") = Range("B77").Value
.Fields("ImportDate") = Date
' add more fields if necessary...
.Update ' stores the new record
End With
rs.Close
strSQL = "SELECT tblcandidates_v2.ContactID,
tblcandidates_v2.*"
strSQL = strSQL & " FROM tblcandidates_v2 "
strSQL = strSQL & " WHERE" & " ((tblcandidates_v2.ContactID)"
&
" =" & " & "Range( " & "B77" & ").Value & )"""
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
With rs
If .RecordCount > 0 Then
.MoveFirst
.Edit
!NextSteps = Range("G74").Value
!Status = "Yes"
.Update
End If
End With
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
MsgBox "Complete"
End Sub Tag: greetings!! Tag: 106851
Opening ASCII Files
Word XP
I have a macro in WordPerfect that opens an ASCII file so that I can then
convert to a merge file. The perfect script is:
FileOpen (Filename:"c:\temp\dunning.txt"; Format:ASCIIStandard!)
Word will open the ASCII file but is not displaying it right. Was wondering
if someone could convert the above to VBA for me . . .
Tks . . . Tag: greetings!! Tag: 106850
Flesch Score - programmatically possible
Hi all.
I know it is possible to get the Flesch readability ease score / grade by
checking the option in grammer & spelling, then running a spell check... the
value is displayed at the end.
Is it possible to force a 'silent' check and programmatically get this
result, or maybe run the check without it prompting user input for any found
problems... it would then run through to end stats...
ActiveDocument.ShowGrammaticalErrors = False
ActiveDocument.ShowSpellingErrors = False
makes no difference... can't seem to find much searching this group... maybe
i'm looking in the wrong place. any guidance greatly appreciated. Tag: greetings!! Tag: 106848
Identify page on which a bookmark is located
I have code (obtained from this group in response to an earlier question) to
print only the part of a document between two bookmarks. The following
works inconsistently. Details are after the code. The code itself is in an
Add-In.
Dim x1 As Long ' start character of bookmark
Dim x2 As Long ' end character of bookmark
Dim p1 As Long ' start page
Dim p2 As Long ' end page
Dim rTmp As Range
Set rTmp = ActiveDocument.Range
' Allow for a bookmark at the beginning of document
If rTmp.Bookmarks("DocStart").Range.Start = 0 Then
x1 = 1
Else
x1 = rTmp.Bookmarks("DocStart").Range.Start
End If
x2 = rTmp.Bookmarks("DocEnd").Range.End
p1 = rTmp.Characters(x1).Information(wdActiveEndPageNumber)
p2 = rTmp.Characters(x2).Information(wdActiveEndPageNumber)
ActiveDocument.PrintOut _
Range:=wdPrintFromTo, From:=CStr(p1), To:=CStr(p2)
Set rTmp = Nothing
When the bookmarks DocStart and DocEnd are on the same page (so that only
one page is printed, which is the case most of the time) it seems to work as
intended. However, in other situations the results are mixed at best. For
instance, DocStart is on page 7, but p1 is 9 when I step through the code.
In the same document, if DocEnd is on page 8, it is identified as 11. That
is, the variables p1 and p2 are 9 and 11 rather than 7 and 8.
Another problem I have noted is that I cannot find a place for the DocEnd
bookmark in a two-page document (I want to print both pages) that is not
identifed as either page 1 or page 3. However, if I use the Word Count
toolbar to count the number of characters, and replace x2 with that number
(e.g. 2408), this line properly identifies p2 as 2:
p2 = rTmp.Characters(x2).Information(wdActiveEndPageNumber)
If I do not manually set x2 to 2408, it is identified as something like 4500
(which is more than the total number of characters in the document), and
that line of code throws the following error:
5941 - The expected member of the collection does not exist
That is all the information I have been able to obtain. The problem seems
to be the same whenever it occurs: the character position of the bookmarks
(the variables x1 and x2) are not identified properly.
If I could identify the page on which each of the bookmarks is located, I
could get the code to do what is needed. If this is not possible, I could
settle for setting the variables p1 and p2 manually for documents in which
problems occur, and have the code above start by testing whether the
variables already have a value, and using that value instead of the values
generated by the code, or something like that. I would rather not do that,
but I can accept a workaround if necessary.
I am using Word 2003. If it matters, the code above is designed to include
the header and footer in the printout. Other code with which I experimented
did not print the header and footer. It is better by far if I can include
the header and footer. Tag: greetings!! Tag: 106840
Total number of seconds since computer was started
What function should I use to get the total number of seconds since
computer started (or similar).
Since midnight is not good (unless since midnight before computer was
started.
Thanks
H. Martins Tag: greetings!! Tag: 106837
Rotating a logo in header
Hello,
I am developing a template (Report.dot) in MS Word XP. This template
contains a macro that inserts a new page, oriented landscape. The contents of
the header and footer on this page must be rotated and re-positioned on the
right and left edge of the page (using ranges and frames) so that when the
final document is printed and assembled, all headers and footers are
consistent.
My problem is when I try to select and rotate the logos (jpeg images), I get
the following runtime error : "-2147024891 This member cannot be accessed at
this time".
The code I am using is as follows:
Dim rngHeadr As Range
Dim shpLogo As Shape
With ActiveDocument.Sections(intSectionID)
Set rngHeadr = .Headers(wdHeaderFooterPrimary).Range
End With
For Each shpLogo In rngHeadr.ShapeRange
shpLogo.Select ' <- Error occurs here
Selection.ShapeRange.IncrementRotation 90#
Next
Can anyone give me a work-around ? I will be very grateful !
--
Lars Tag: greetings!! Tag: 106835
2007 looking for xp object library
Hi,
I created a template in Word XP which automates a tender document creation
procedure for our sales guys. We have now all been upgraded to Office 2007.
Since our upgrade this procedure no longer works, I suspect that it may be
down to only having Microsoft Word 12.0 Object Library available. How can I
make the Word XP (10.0??) object library available and would I have to
install this into the references section of every user?
Many thanks
Kerry Tag: greetings!! Tag: 106834
word used in a service
Hello,
I have an application which has to run as a windows service. This
application create a word instance via a library of mine with the call:
word::_ApplicationPtr myApp;
myApp.CreateInstance("Word.Application.11");
(it is wrote in VC++)
Fom here i have two problems:
First i would like Word to use a temporary directory of mine instaed of the
global \Windows\temp\ one. I tried tu use _putenv (to set TEMP and TMP) just
before calling Createinstance but Word doesn't care and i tried to set the
service as a user instead of System but Word keep using the global
\Windows\temp\ direectory. What is disturbing me is when i launch the
application in a console, not as a service the Word instance use the temp
directory specified by _putenv. So my question is: What i have to do to see
Word using my specified Temp directory.
My second problème is when i make a specific treatment with the application
launched as a service i get word to "freeze" at a certain point. I am quite
sure it is because it opens a popup dialog and wait until a user answer the
question (i got a similar problem before that i solved by catching the popup
in console mode and set the corresponding code to not display this dialog
again). And I can't see this dialog since word is launched from a service
(and there I can't reproduce the problem in console mode). I tried to set a
specific user for the service or tried to check the box "Allow service to
interact with desktop" but i got nothing. So my second question is what can i
do to get what word want?
I use the computer where the application is launched with remote connection
desktop i hope it does not affect the interactions between services and destop
thanks in advance for any advice Tag: greetings!! Tag: 106833
Find multiple items and replace multiple items
Hello,
I'm looking for a macro to replace multiple items such as below. I have
Word 2003. I appreciate any help you can provide. Thanks!
Find: "One" Replace with "One (1)"
Find: "Two" Replace with "Two (2)"
Find: "Three" Replace with Three (3)"
...and so on and so forth.
--
Smile...it is good for you! :) Tag: greetings!! Tag: 106829
If calculation field has 0 result, blank
I have several rows in a table, with the last column being a calculated form
field of A1*B1.
The table has 10 rows, but the user might only fill in 1 or 2 of the rows.
For the rows that have no data (essentially, blank Col1 and Col2), the total
column always displays a 0 value.
How can I make this field display BLANK (or null if you will) if Col1 and
Col2 are blank?
I know a formula field will do this, but I need it to be a form field,
because I use these field further down in more calculations. (essentially
need the bookmark name, and a formula field in word does not have a name, so
I must use a form field)
I have tried formatting the field, as suggested in this webpage
http://www.gmayor.com/formatting_word_fields.htm
And putting the switch as part of the formatting, however, to no avail.
\# "$0;($0);" Tag: greetings!! Tag: 106822
Embedding Macros to pass around
I'm setting up macros to make life a little easer in a Word form on my
computer. However, when I e-mail the document to others, the macros don't go
with it. So I'm going from cpu to cpu in the office setting up the macros
manually.
Is there a way to "embed" the macros I'm creating in the document itself so
that if I create them and e-mail the document the macros go along with it? Tag: greetings!! Tag: 106820
Determining the keypress that got me here
How can I determine which key the user pressed to launch the macro I'm in?
The application is that I'd like to assign Alt+( and Alt+" to the same
macro, but enclose the selection either in parentheses or double quotes.
How can I tell which one the user pressed to launch the macro?
Bear
--
Windows XP, Word 2000 Tag: greetings!! Tag: 106817
Macro Save as Document
Hello Experts !!
I would like to create a macro for saving the document in a specific
folder (choose by user) and remove the macros from the "template"
document...
The saved document must be cleared off from any macros !
Thanks a lot
St=E9phane Vial Tag: greetings!! Tag: 106814
french diacritical marks
I would like to find out how I can add the various diacritical marks to the
words when I am preparing work for my French class. TKS for any help.....
--
papafarmer Tag: greetings!! Tag: 106813
Unloaded template from STARTUP folder
Hello !
Sometimes, after a crash I guess, some of the templates in my STARTUP
folder are not loaded when I start Word. If I go to 'Options',
'Templates and Add-ins' they are listed in the 'Global templates and
add-ins' list but they are unchecked.
How can I 'recheck' these using VBA? I have a VB app that does some
setup/cleanup for our templates, so I could check from that app to
make sure that the STARTUP templates are always loaded when Word is
started.
Thanks
J Whales Tag: greetings!! Tag: 106809
a Keyword search Macro?!
I would like to create a macro or some other kind of function that
automatically highlight keywords when I open a document. Is that a capability
within Word, or is there an outside resource anyone knows of that can
accomplish this?
Thanks!
Stacy Tag: greetings!! Tag: 106807
Text Form Field Values
HELP!!!! I'm sure this is something simplistic for your "pro's", but I sure
ain't get'n the right syntax figured out on this one.
I am creating a protected form for which obviously contains a number of Text
Form Fields. I am ATTEMPTING to ask the user - upon entry to a particular
field - for the data. Once data is obatained, it should not only fill the
current field for which it is being asked, but also be passed on to another
text field in the form (so to save them entry time etc.). I have read on the
Fill-In and Ask field codes, but I apparently just ain't get'n it.
Your expertise is very much appreciated.
Thank you! Tag: greetings!! Tag: 106806
Word's references
I am asking this again in hopes of someone knowing what to do here
I have a vs2007 project "MCTClass07" that I created using extensibility
add-in
for Word 2007. A .dotm is loaded by a third party application that makes
reference
to MCTClass07 as follows
Public MCTai As MCTClass07.Class07
' The architecture demands that a template provides this entry point.
However all other code can be implemented in the .NET code.
Public Function MSGatewayInitialize(Odbcstr As String, Libname As String,
recordID As Long, docName As String, ByRef rcMsg As String) As Long
Set MCTai = Application.COMAddIns.Item("MCTClass07.Connect").Object
....
Call MCTai.InitDocument(ActiveDocument, Odbcstr, Libname, recordID) 'get
document parts from COM+
....
For all of this to work, I have to load the .dotm file, switch to
developer/visual basic (ALT F11), selecte tools/references, locate the
MCTClass07.tlb file and add it anc check it. This all works fine as does the
.net code
The problem occurs (occasionally) as I make changes to the .net code.
Sometimes when I initiate the Word process (which loads the .dotm file)
I will get a dialog box "could not open macro storage".
If I check the tools/reference settings again, I see the MCTClass is checked
but labeld as "Missing". I uncheck the reference, close the reference
selection
dialog, reopen tools/references, locate and check the MCTClass.tlb
(still in the list), save the .dotm file and retry my application, everything
works fine.
This does not happen every time I change the project code. I often transfer
the solution and develop on other computers then transfer to solution back to
the original development computer. This effort seems to require the dropping
of the project and then locate and check it in VBA more often.
The registry enrtry for
HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins\MCTClass07.Connect
shows the load behavior to be a 3 (which is what it needs to be)
So, how does Word come up with the MCTClass07.tlb as "MISSING" and how can I
prevent this?
Where does Word keep this information about tools\references...?
Is it possible to transfer that reference list with selected components to
other computers?
How can I implant that what should be referenced information to Word. Tag: greetings!! Tag: 106805
Identify tables with 2 columns and delete
Hi all,
I am trying to find all tables containing only 2 columns in a document,
select them, and then delete. Getting no where fast. Any suggestions
gratefully received.
Sub delTables()
Dim oTbl As Table
For Each oTbl In ActiveDocument.Tables
With ActiveDocument.Tables
If NumColumns = 2 Then
'If ActiveDocument.Tables.Count >= 1 Then
ActiveDocument.Tables.Select
Selection.Delete
End If
End With
Next oTbl
End Sub
Thanks,
--
Brian McCaffery Tag: greetings!! Tag: 106796
Capturing a Content Control Range
Has anyone figured out a good way to capture a Content Control's Range? I
don't mean just the range of its text, but the text and it both.
I was working on some code to create a CC bound to CustomXML and then create
a BuildingBlock QuickPart of that control. I could never figure out a
simple way to define the range for the buidling block. If I simply used
.ContentControl(Index).Range the BB was just the text. Here is what I
finally put together but hoping one of you has a better way. Basically I
wrapped a bookmark around the Content control and then set the BB range to
the bookmark range:
Sub CreateBoundCC()
Dim oCustPart As CustomXMLPart
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Dim oCC As ContentControl
Dim oBB As BuildingBlock
Dim oTemplate As Template
Set oBMs = ActiveDocument.Bookmarks
Set oCustPart = ActiveDocument.CustomXMLParts.Add
oCustPart.Load ("E:\Data Stores\mysample.xml")
Set oRng = Selection.Range
oRng.End = oRng.End + 1
oBMs.Add "Temp", oRng
Set oRng = oBMs("Temp").Range
oRng.Collapse wdCollapseStart
Set oCC = oRng.ContentControls.Add(wdContentControlText)
With oCC
.Title = "Clien Name"
.XMLMapping.SetMapping "/root/A", , oCustPart
End With
Set oTemplate = ActiveDocument.AttachedTemplate
oBMs("Temp").Range.End = oBMs("Temp").Range.End - 1
Set oRng = oBMs("Temp").Range
oBMs("Temp").Delete
Set oBB = oTemplate.BuildingBlockEntries.Add("Client Name",
wdTypeCustomQuickParts, "My Custom BBs", oRng)
Set oCustPart = Nothing
Set oBB = Nothing
Set oCC = Nothing
Set oBMs = Nothing
Set oRng = Nothing
End Sub
Thanks.
--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word. Tag: greetings!! Tag: 106791
Autonew macro won't run
G'Day all!
Can someone please tell me why the following would suddenly stop running?
Private Sub Document_New()
UserForm1.Show
End Sub
I have created UserForm1 in my template and the form was loading correctly
on opening a new document based on that template. I have since edited the
fields on UserForm1 but the name is unchanged.
I am now getting:
Run-time Error '5941':
The requested member of the collection does not exist
Any suggestions gratefully received!
--
AnnieB
Basic Babe in the Woods Tag: greetings!! Tag: 106772
Removing Line Breaks in Selected Text
I want to be able to select a few lines of text, and then remove all
the line breaks (only) in that selection and replace the linebreak
with a space.
How do I do that? The following code does not work properly. I am
using Word 2003.
Thank you.
---------------------------------------------------------------
Sub SelectionRemoveHardLineBreaks()
Dim oRng As Word.Range
Set oRng = Selection.Range
With oRng.Find
.Text = "^p"
.Replacement.Text = " "
End With
Do While oRng.Find.Execute
With oRng
.Find.Execute Replace:=wdReplaceOne
End With
Loop
End Sub
--------------------------------------------------------------- Tag: greetings!! Tag: 106768
SLOW repsonse to recognize network printers
Hello,
The following code is attached to a letter template for which the paper
trays must be tray 2 and 1 on the printer 10st1_HP4350. I put the first line
of code in and the NE" & i & ":" to run through all possible numbers
following the NE, since I found that each day, the NE number was changing for
the printers. This code works, but is slow, and I need to add 16 more
printer names to the code. IT IS PAINFULLY SLOW.
I need code to change trays for the active printer detected when I run the
letter template, REGARDLESS of the number following NE, and it needs to be
very fast.
Any ideas??? Thanks so much!
Kurt
For i = MinNeNumber To MaxNeNumber
Application.ActivePrinter = "\\FS01\10st1_HP4350 on NE" & i & ":"
With ActiveDocument.PageSetup
.FirstPageTray = 261
.OtherPagesTray = 262
End With
Next Tag: greetings!! Tag: 106767
Email Word Document
Thank you in advance for your time.
I have a button at the bottom of my Word document that reads "SUBMIT" When I
click the button, is there anyway it could email itself to a particular
person?
It keeps prompting me to enter the email address. I'm trying to get around
it so I don't have to type the address in everytime I submit.
I do appreciate your time.
thanks,
tim
tim Tag: greetings!! Tag: 106766
Word 2007 Track Changes Customization
Is it possible to mark up insertions as both bold and doubleunderline?
Is it possible to turn off Track Changes warning for print, save etc.? Tag: greetings!! Tag: 106754
Macro in mailmerge
Hi everyone!
I have written a macro to split the mailmerge document after we complete the
mailmerge , but there is a small problem here: I dont want to create an addin
so I just want to add the macro to a document or templete( not Normal.dot)
and be able to access it after the user complets the mailmerege but as most
of you know after creating a mailmereg word creates a new document based on
the fields and the macro is not accessable through toolbar button so I must
use the VBAeditor to run it. So my question is how can I have this splitmerge
macro in a document and be able to access it after completing the mail merge?
--
Best regards,
Edward Tag: greetings!! Tag: 106752
Clear Formatting behaviour
In Word 2003 on WinXP:
If I use Clear Formatting on a string of text that has a character
style applied to it, the character style is removed from that string.
However, the paragraph style for the paragraph as a whole remains.
However, if I protect the document with formatting restrictions, then
the behaviour of Clear Formatting changes. In that case, if I use
Clear Formatting exactly as described above, then the whole paragraph
loses its paragraph style, as well as the character string losing its
character style.
This discrepancy is the same whether I am using the user interface or
VBA.
Anybody have any idea why, and what I can do about it? This is going
to clobber a feature I'm trying to put in play for my user set.
TIA--
--larry Tag: greetings!! Tag: 106749
Autotext page numbering won't update!
I used autotexts for automatic page numbering that appear outside the
header/footer area:
{ page} of { numpages}
And it worked . . . initially. However, the "numpages" field won't
update even though more pages added. I tried switching the view mode,
closing and re-opening the file, etc., but still it won't update. Did
I miss any step, or is there any way to fix this problem?
PLEASE HELP!
Joy Tag: greetings!! Tag: 106748
Upgrading from Word and Outlook 2003 to Word and Outlook 2007
I have several macros that "grab" addresses from Outlook and put them into my
form/letter in Word in 2003. Now that the upgrade has happened all the
autotext and the rest of my code works fine EXCEPT the get address part of
the code. It returns the value in my variables, however, it simply does not
return the value to the textbox fields in my form and of course does not put
it into the final letter document. Here is my code. Again, the variables (
rcpFirstName1, rcpLastName1, rcpAddress1) are returned correctly and the
frmContacts.txtName1.Value, frmContacts.txtC1.Value and
frmContacts.txtSal1.Value are also returned correctly. However, they do not
populate the fields on the dialog nor do they get entered into the final
letter.
Public Sub cmdOC1_Click()
DialogReturn = rcpDisplayName1 =
Application.GetAddress(AddressProperties:="<PR_DISPLAY_NAME>",
DisplaySelectDialog:=1)
rcpCompanyName1 =
Application.GetAddress(AddressProperties:="<PR_COMPANY_NAME>",
DisplaySelectDialog:=2)
rcpFirstName1 =
Application.GetAddress(AddressProperties:="<PR_GIVEN_NAME>",
DisplaySelectDialog:=2)
rcpLastName1 = Application.GetAddress(AddressProperties:="<PR_SURNAME>",
DisplaySelectDialog:=2)
rcpBusFaxNo1 =
Application.GetAddress(AddressProperties:="<PR_BUSINESS_FAX_NUMBER>",
DisplaySelectDialog:=2)
If rcpCompanyName1 = "" Then
strAddress1 = "<PR_POSTAL_ADDRESS>"
Else
strAddress1 = "<PR_COMPANY_NAME>" & vbCr & "<PR_POSTAL_ADDRESS>"
End If
rcpAddress1 = Application.GetAddress(AddressProperties:=strAddress1,
DisplaySelectDialog:=2)
'populate fields in frmContacts
If DialogReturn = False Then
frmContacts.txtName1.Value = rcpFirstName1 & " " & rcpLastName1
frmContacts.txtC1.Value = rcpAddress1
' frmContacts.txtSal1.Value = rcpFirstName1 & " " & rcpLastName1
mReturn10 = True
Else
mReturn10 = False
End If
End Sub
This macro is being used a LOT in quite a few firms so any help would be
greatly appreciated!
--
CLG Tag: greetings!! Tag: 106738
How can I call a macro from an unviewable project
I have a macro in a template that I can manually run using the Tools-
Macros menu option. In the VBA editor though when I try and expand
the document it's from in the project pane I get a messagebox titled
"Project Locked" with a message of "Project is unavailable". I tried
manually writing the code to run it, but get an error 424.
ProjectName.ThisDocument.MacroName Tag: greetings!! Tag: 106734
My INSERT FILE is busted
Group,
I have no clue how I accomplished this, but each time a new MSWORD 2003
document is created, I select INSERT, FILE, it automatically inserts a
document from something I've worked with in the past, (I'm not even sure
where this documents exists??) I no longer receive the dialog box to choose a
picture, a file, etc.., it's already chosen for me. I've reset my toolbar,
but still cannot INSERT a FILE of my choice, it automaticaly is choosing it's
own file. How can I get behind the INSERT FILE command?? Tag: greetings!! Tag: 106733
Corrupted Documents
In our very large company, we have documents that have been around for years,
been modified by many users, and on different computers. As a result, the
documents are getting corrupted. This includes numbering that gets moved,
revisions that come and go by themselves, and headers realigning to name a
few.
Is there any way to restore the document or fix these corruptions? Tag: greetings!! Tag: 106731
Word 2007: Options.ReplaceSelection -> Run-time error 4120 Bad Parameter
Hi,
In April, jalanford wrote a carefully composed message in
microsoft.public.word.vba.general on the subject of run-time errors when
trying to set a number of parameters like Options.[SomeParameter] via VBA.
The problem occured only on some machines with Word 2007 and Windows XP. We
can't reproduce it on our machines, and we have no direct access to machines
affected by the problem.
But we have the same problem with a small number of our customers and are
looking for the best way to make our add-in work on their systems - other
then writing a patch for our software, which we will do anyway. If the
registry is involved, even a patch will probably require some "manual"
action by the customer in certain cases. So far, we succest to run our Word
add-in on a newly created user account, which worked in all known cases, but
is far from ideal, of course.
Unfortunately, the discussion then in the newsgroup stopped before someone
provided a solution. The only suggestion was to repair the registry, but
there was no follow-up.
Could jalanford or someone else please give some advice how you worked
around the problem? If so, I would try to compile an answer to the problem
for the newsgroup.
Thanks in advance
Hans Tag: greetings!! Tag: 106728
Macro to be available in documents based on a template
I would like a macro I have created in a template (.dot) to be available in
documents (.doc) created from the template (ie. when other people in my
workplace double-click on the template. At the moment, when I double-click
on the template (it creates a .doc version of it )and I go to the list of
macros, the macro I created doesn't show up in the .doc version. What am I
doing wrong. Thank you for any assistance you can offer. Tag: greetings!! Tag: 106724
Compacting access database using VB
Hi,
This is actually an MS Access problem, but i thought i'd put it here as
well. If anyone can help....
I am working on a database and on a specific form i have a button for
'Compact Database'. Now the code i use to compact onClick of the button is:
CommandBars("Menu Bar").Controls("Tools").Controls("Database
utilities").Controls("Compact and repair database...").accDoDefaultAction
This works fine except if a guy in say, japan, uses it and has a japanese
language pack, then access cant find "Menu Bar", "Tools", etc. cause they are
in english in the code and in japanese in access and a problem occurs.
so i wanted to know if there is a different way to compact where i could
probably use some internal properties etc. and where language wont be a
problem. I need to compact an active database.... Tag: greetings!! Tag: 106723
HP Desktop for sale!
Hi,
I have an unused HP Pavilion with the fallowing specs:
# Processor: AMD Athlon 64 X2 4000+ (2.1GHz, 2000MT/s System Bus)
# Memory: 2048MB PC2-5300 DDR2 SDRAM memory (2x1GB) (expandable to 8 GB (4 x 2 GB) (64-bit OS)/ 4 GB (4 x 1 GB) (32-bit OS))
# Hard Drive:320GB 7200RPM SATA 3G (3.0 Gb/sec) hard drive
# Optical Drive: 16X DVD(+/-)R/RW 12X RAM (+/-)R DL LightScribe SATA drive
# Expandable Drive Bay: HP Pocket Media Drive bay
# Video Graphics: Integrated graphics
# Network Interface: Integrated 10/100BaseT network interface
# Sound: High Definition 8-channel audio
# Fax/Modem: 56K bps data/fax modem
# Operating System: Genuine Windows Vista® Home Premium
This is "used" but basically brand new (it has literally been on for no more than 6 total hours..) is only 1 month old..
PRICE: $425 OBO
Email- pbdude911@yahoo.com Tag: greetings!! Tag: 106714
Watch NFL Games Online
Watch NFL Games Online!
For every one who wants to watch the games online because they dont live in the teams town or are at work i found a site that has basically every game covered. Its perfect if you have afford a monthly $70 direct tv nfl access subscription. they got a bunch of channels
The sites http://nflonline.wizhoo.com Tag: greetings!! Tag: 106713
Protected Form Fields in Header Area
I have a question regarding the header/footer in a protected form.
Is
there a way to insert form fields in the header/footer in a protected
MS Word form? When an user opens the form file, I'd like the person
to go to the header and fill in the form fields, close the header,
and then fill in the rest of the form. And the header information
should repeat every page of the form. Right now it seems that when
protected, the user cannot access the header. Can anyone help me
with
this issue, if there's a way around it? Thank you!
Joy Tag: greetings!! Tag: 106711
Fatloss computer program
I have been using this computer program for a couple weeks now and i am very pleased with the results so far. its a software fatloss program, if your looking for a diet/weightloss plan i reccomend you check this place out first: http://fatloss9.50webs.com Tag: greetings!! Tag: 106710
Automatic update of footer macro
I'm posting this for a user who sent me the following query, which I've
inserted below as submitted to me:
"Hi ,
Don't know if you know any VBA but I have a problem that I haven't been able
to resolve. I don't know any VBA but I can usually cheat by looking
something up via google or recording a macro and transferring and altering
parts of the code to do what I need it to do. But I haven't been able to
figure this one out:
I have a footer macro that I set up to include the "last author" and "last
modified" items rather than the current date/time and the original author.
The problem with my footer is that it doesn't update these items
automatically when I save. It will only update if I re-run the macro to
insert the footer. (This is the same problem as with using the regular
pathname footer in Excel - which doesn't update when you use save as and save
a file with the pathname in the footer to a new location.)
Sub Footer()
'
' Footer Macro
' Macro recorded 3/26/2007 by atao
'
ActiveSheet.PageSetup.LeftFooter = "&8Last Modified by " & ActiveWorkbook. _
BuiltinDocumentProperties("last author").Value & " " &
ActiveWorkbook. _
BuiltinDocumentProperties("last save time") & Chr(10) & "&Z&F\&A"
ActiveSheet.PageSetup.RightFooter = "&8&P of &N"
End Sub
So, I am either trying to find a way for those items to auto-update as does
current date and time (when you use &[date] &[time] (which I have a feeling
can't be done for Builtin Document Properties or have the macro re-run
automatically upon saving. I found something called "OnAction" property that
may do the trick when save is pressed but I actually don't know any VBA so I
thought maybe you would be able to help me?" Tag: greetings!! Tag: 106705
linked drop down text box
i have a word form with a drop down text box. depending on what is chosen i
would like two other boxes to be populated. Can anyone point me in the right
direction? Tag: greetings!! Tag: 106697
Help with inlineshpae textbox
hello,
I have a form with a number of textboxes embedded as inlineshapes, each of
which have a dblclick event assigned to them - this works just fine. I
would very much like to have a seperate click event to do something else,
but a textbox (as an inline shape) does not have a click event. I tried
using a mousedown event, but this activated before I could double click it.
Embedded labels do have both click and doubleclick events, and these work
but are not what I need for this application.
here is what the double click does: , the single click would have to start
a different subroutine.
Private Sub TBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
TBox1.Text = ChangeTextBoxText(GetILS, TBox1.SelStart, TBox1.Text)
End Sub
Thanks Jim Tag: greetings!! Tag: 106694
Can you suggest modifications to speed up this function?
What I am trying to do it to go through a list of Word documents and create
an array containing two parameters for each TOC entry. The first entry is
made up of the filename, a "|" as a delimiter and the TOC entry text
(includes all levels up to that point concatenated with a >). The second
entry of the array is the page number associated with the TOC entry. This
works as it is but it is painfully slow. I added the flag that is set when
the TOC Title paragraph is found to be able to stop the processing once all
of the TOC # entries had been processed and that has helped some but this is
still very slow. Is there a different approach that would speed this up?
Thanks.
Private Sub GetDocumentsHeadingsForFileInPath(wordFileName, wordFilePath)
Dim oApp As Object
Dim oDoc As Object
Dim oSec As Object
Dim NumSections As Integer
Dim foundTOC As Boolean
Dim st As String
Dim tocLastValues(9) As String
'Start Word and open the document.
Set oApp = CreateObject("Word.Application")
On Error Resume Next
Set oDoc = oApp.Documents.Open(wordFilePath)
If Not oDoc Is Nothing Then
'Iterate each paragraph in the document to find the table of content
entries
'Get their level, text and page values
'Once you have found the Table of Contents, stop at the next style
that is not a TOC #
NumSections = oDoc.Paragraphs.Count
foundTOC = False
For i = 1 To NumSections
Set oSec = oDoc.Paragraphs(i)
If Not oSec Is Nothing Then
st = oSec.Style
If st = "TOC Title" Then
foundTOC = True
ElseIf Left(st, 3) = "TOC" Then
currentLevel = Right(st, 1)
currenttext = Split(oSec.Range.Text, vbTab)(0)
currentPageNo = Split(oSec.Range.Text, vbTab)(1)
currenttext = GetFullTextForLevel(tocLastValues,
currentLevel, currenttext)
'Debug.Print "Level: " & currentLevel & " Text: " &
currenttext & " Page: " & currentPageNo
allValues(0, noEntries) = wordFileName & "|" & currenttext
allValues(1, noEntries) = currentPageNo
noEntries = noEntries + 1
ElseIf foundTOC Then
Exit For
End If
End If
Next
End If
'Close the document without saving changes and quit Word.
On Error Resume Next
oDoc.Close
oApp.Quit
Set oSec = Nothing
Set oDoc = Nothing
Set oApp = Nothing
End Sub
Private Function GetFullTextForLevel(currentValues, thisLevel, levelText)
Dim i As Integer
Dim tempText As String
tempText = ""
'blank out everything above this level
For i = thisLevel To 9
currentValues(i) = ""
Next
'set this level's text
currentValues(thisLevel) = levelText
'build the string for this level
For i = 1 To thisLevel - 1
tempText = tempText & currentValues(i) & " > "
Next
tempText = tempText & currentValues(thisLevel)
GetFullTextForLevel = tempText
End Function Tag: greetings!! Tag: 106692
Find String, Copy/Paste Next 255+ Characters to New .doc
Does anyone know of a way to search for a certain string, such as
â??Additionalâ?? and then copy/paste this into a new document, along with the
following 255 characters? Is 255 the limit? I found the code below on this
DG:
Sub RTM4()
Dim oDoc As Document
Dim oSrcRg As Range, oDestRg As Range
Set oSrcRg = ActiveDocument.Range
Set oDoc = Documents.Add
Set oDestRg = oDoc.Range
oDestRg.Collapse wdCollapseEnd
With oSrcRg.Find
.ClearFormatting
.Text = "Additional ?{255}"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
Do While .Execute
oDestRg.FormattedText = oSrcRg.FormattedText
oDestRg.Collapse wdCollapseEnd
oDestRg.InsertParagraph
oDestRg.Collapse wdCollapseEnd
Loop
End With
Set oDestRg = oDoc.Range
oDestRg.ConvertToTable Separator:=wdSeparateByTabs, _
NumColumns:=3, NumRows:=100, _
AutoFitBehavior:=wdAutoFitFixed
With oDoc.Tables(1)
.Style = "Table Grid"
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
oDoc.Activate
Set oSrcRg = Nothing
Set oDestRg = Nothing
Set oDoc = Nothing
End Sub
It works great. Sometimes the string, such as â??Additionalâ?? is in a table,
and the code seems to struggle with the tables sometimes. For instance, if I
have the word â??Additionalâ?? in one table, I'd like to find 255 characters, or
more, up to 500 characters, in an adjacent table, just to the right on this
table. Any suggestions?
Regards,
Ryan
--
RyGuy Tag: greetings!! Tag: 106690
INCLUDETEXT w/DOCVARIABLE
I have two documents, â??DOCUMENT Aâ?? reads, â??Thank you for the amount of
{docvariable MONEY}, etc.....
â??DOCUMENT Bâ?? reads: â??I received your payment,, {include text
\\server\path\documentA.doc}. Your prompt payment etc, etcâ?¦â??
The problem is when DOCUMENT B is opened by a user to complete, â??DOCUMENT
Aâ?? is inserted but it does not include the {docvariable MONEY}â?? â?? only the
text.
Is there another field that I should be using instead of the INCLUDETEXT?
Is this my problem, the INCLUDETEXT statement? â??
Diane Tag: greetings!! Tag: 106688
MVP Userform How2 question for Doug Robbins
At the MVP website location:
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm
...Under Step 2, Doug says that after creating a bookmark, "You can then use
a cross reference to the text of the bookmark if you want the same
information to appear in another location."
Several of the items in my userform need to appear in multiple locations
throughout the document, but so far, my experiments with cross references
produce no success. In fact, when I place the cursor in those other locations
and try to insert a cross reference to the original bookmark, nothing gets
inserted. What am I missing?
Thanks, Tag: greetings!! Tag: 106687
what are the steps in formating a personal computer?