I saved a template to a new name and when I run it ...
I have multiple projects with the same name in different times of
developement listed in the IDE screen under which is the new document I want
to work with. How do you "save as" a template and not inherit its parents
projects in the IDE project view? Also the new document is running under the
older verion of the multiple projects listed (all with the same name)...
--
Otium Cum Dignatate Tag: VBA code to tell you who has a file open Tag: 86307
Accessing "Style" taking forever in Word 2003
I have a number of macros written and used in Word 2000 which examine a
paragraph's style and then taking action based on that style. When
these are run on Word 2003, the macros go from a run time of 4 seconds
to one of 1 minute 53 seconds. Any ideas? (I'm using XP). Tag: VBA code to tell you who has a file open Tag: 86306
Switching Windows Error
Hello,
Currently, I am working on a document that analyzes other documents.
Basically, the user clicks on a button and a dialog box opens up to
browse to a file and the analyzation begins.
It can bring up the dialog box correctly and minimize the current
window of the original document, but when I try to bring the document
to be analyzed into focus, it gives the error:
'Runtime error 5941':
The requested member of the collection does not exist.
Here is the code:
With Dialogs(wdDialogFileOpen)
.Display
DocToAnalyze = WordBasic.FilenameInfo$(.Name, 2)
End With
'On Error GoTo ErrorHandler
'Windows(analyzedoc).WindowState = wdWindowStateMinimize
Windows(DocToAnalyze).Activate
I have commented everything out around the last line and targeted it as
the source of the error, but I am not for sure why. I have tried
putting in other documents open such as "Document4.doc" and "Document4"
but to no avail.
Thank you for any help. Tag: VBA code to tell you who has a file open Tag: 86298
How can I make my code run faster?
I have a MS Word 2003 form in which I have 40 checkboxes.
This code below works great but it is r-e-a-l-l-y slow. The reason being
that it is checking each checkbox every time. What I'd like to do is to
speed it up.
Can someone help? I aprpeciate it greatly.....
Function Calculate()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim intWait As Integer
StatusBar = "Please wait..."
For intWait = 1 To 1000
System.Cursor = wdCursorWait
Next intWait
Dim mI As Integer
Dim mColRate As Integer
Dim mCol1Tot As Integer, mCol2Tot As Integer, mCol3Tot As Integer
'look at each item that is a formfield on the active document
For mI = 1 To ActiveDocument.FormFields.Count
'this is checking if this formfield is a checkbox vs a textbox ...
If ActiveDocument.FormFields(mI).Type = wdFieldFormCheckBox Then
'this is looking for something in the name of the checkbox which
keys the loop
'that I want to do something with this particular checkbox
If InStr(1, ActiveDocument.FormFields(mI).Name, "Ineffective") >
0 Or _
InStr(1, ActiveDocument.FormFields(mI).Name, "Capable") > 0
Or _
InStr(1, ActiveDocument.FormFields(mI).Name, "NA") > 0 Or _
InStr(1, ActiveDocument.FormFields(mI).Name, "Superior") > 0
Then
'this counts all boxes that need to be counted in the above
list
mColRate = mColRate + 1
'determines which column needs to be counted and keep a total
If InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective1") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable1") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior1") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective2") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable2") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior2") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective3") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable3") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior3") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective4") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable4") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior4") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective5") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable5") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior5") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective6") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable6") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior6") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective7") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable7") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior7") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective8") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable8") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior8") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective9") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable9") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior9") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Ineffective10") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol1Tot = mCol1Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Capable10") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol2Tot = mCol2Tot + 1
ElseIf InStr(1, ActiveDocument.FormFields(mI).Name,
"Superior10") > 0 And _
ActiveDocument.FormFields(mI).CheckBox.Value = True Then
mCol3Tot = mCol3Tot + 1
End If
End If
End If
Next
ActiveDocument.FormFields("Col1Tot").Result = mCol1Tot
ActiveDocument.FormFields("Col2Tot").Result = mCol2Tot * 2
ActiveDocument.FormFields("Col3Tot").Result = mCol3Tot * 3
ActiveDocument.FormFields("Total").Result = ((mCol3Tot * 3) + (mCol2Tot
* 2) + mCol1Tot) / 40
MsgBox ("Calculation Completed")
StatusBar = "Task completed"
System.Cursor = wdCursorNormal
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Function Tag: VBA code to tell you who has a file open Tag: 86297
Strange Print error with VBA created doc
Hi This may or not be vba related.
Has anyone ever encountered a prioblem like this before, Or know a
solution
A table cell in a word doc contains multiple address lines, created
using the code below in a template.
The address loooks just fine in Word and even in print preview, but on
the actual paper on the first line appears. Also intermittent , works
ok on some printers.
Users have found a workaround, cut the address then paste it back
before printing.
Any thoughts ?
Thanks
hals_left
Set objRS = objConn.Execute(strSQL)
If Not objRS.EOF Then
strAddress= objRS("BusinessName")
strAdd1 = objRS("Add1")
strAdd2 = objRS("Add2")
strAdd3 = objRS("Add3")
strTown = objRS("TownCity")
strCountyLine = objRS("County") & vbTab & objRS("PostCode")
If strAdd1 <> "" Then strAddress = strAddress & vbCrLf &
strAdd1
If strAdd2 <> "" Then strAddress = strAddress & vbCrLf &
strAdd2
If strAdd3 <> "" Then strAddress = strAddress & vbCrLf &
strAdd3
If strTown <> "" Then strAddress = strAddress & vbCrLf &
strTown
strAddress = strAddress & vbCrLf & strCountyLine
ActiveDocument.Tables(2).Rows(1).Cells(1).Select
Selection.Text = strAddress Tag: VBA code to tell you who has a file open Tag: 86295
How do I download a version of Microsoft Word?
My computer crashed and I seemed to have lost Microsoft word and I want to
know how I can download a version of it or do I have to buy the software from
the store. Tag: VBA code to tell you who has a file open Tag: 86285
Save Word document to a database
For memo type fields in my database I want to be able to use word as the
editor. I have a Visual studio 2005 forms based application that interacts
with the database listed invoices etc.. I would like to be able to invoke
word as the editor for description type fields similar to how outlook uses
word for it's message editor. Does anyone have any examples, sample code, or
concepts regarding how to go about doing this?
I am thinking of an approach that would use VSTO. I would have an edit
button on the application that would say invoke word to edit. The
application would retrieve the memo data from the database ( I am thinking
that perhaps I should store the description in HTML format), invoke word,
load the data into word. Then muck with the menus and capture the save and
save as commands and write code to save the data to my database instead of a
file.
I am having trouble figuring out exactly how to go about loading the data
into word and getting the data to save it back out to the database.
Thanks Tag: VBA code to tell you who has a file open Tag: 86284
Gremlin space in string data
With the extensive help of Jay Freedman and Jonathan West, I am
beginning to understand color in Word. I have put together a macro for
extracting the Long and RBG value of a color selected in the
Format>Borders and Shading>Shading dialog. I have one problem. For
some odd reason there is an extra space in the second message box
dispaly:
oColorRBG = Str$(rVal) & ", " & Str$(gVal) & ", " & Str$(bVal)
MsgBox "Color long value: " & oColorLng
MsgBox "Color RBG value: (" & oColorRBG & ")"
For "Red" is should dispay: Color RBG value: (255, 0, 0) but it is
coming out
Color RBG value: ( 255, 0, 0)
I can't figure out how to close up the space between the ( and 255.
I realize that this is a minor nit, but would like to figure it out
just the same. Thanks.
Here is the complete code:
Sub QuickAndEasyColorData()
Dim oDoc As Word.Document
Dim oRng As Word.Range
Set oDoc = Documents.Add
Set oRng = oDoc.Range
Dim oColorLng As Long
Dim rVal As Long
Dim gVal As Long
Dim bVal As Long
Dim oColorRBG As String
oRng.InsertAfter "Sample Text"
oRng.MoveEnd wdCharacter, -1
Application.ScreenRefresh
oRng.Select
With Dialogs(wdDialogFormatBordersAndShading)
If .Show = -1 Then
.Execute
Application.ScreenRefresh
oColorLng = oRng.Shading.BackgroundPatternColor
rVal = oColorLng Mod 256
bVal = Int(oColorLng / 65536)
gVal = Int((oColorLng - (bVal * 65536) - rVal) / 256)
oColorRBG = Str$(rVal) & ", " & Str$(gVal) & ", " & Str$(bVal)
MsgBox "Color long value: " & oColorLng
MsgBox "Color RBG value: (" & oColorRBG & ")"
End If
End With
oDoc.Close wdDoNotSaveChanges
End Sub Tag: VBA code to tell you who has a file open Tag: 86269
Attachment not appearing.
I've got a W2K template that generates a summary of selected documents.
The user is presented with a list box to choose which items are to be
summarized. I also want to send the selected documents as Outlook
e-mail attachments. I use this to start the e-mail (In the Userform
initialization)
Private Sub UserForm_Initialize()
~
mailtxt = "Assessments done " + Format(Now(), "mm/dd/yyyy")
Set maildas = CreateObject("Outlook.Application")
Set mailmsg = maildas.CreateItem(olmailItem)
With mailmsg
.To = "ASSEMAIL"
.Subject = mailtxt
.body = mailtxt
End With
End Sub
Then this to add the attachment (runs after the doc is summarized)
~
attdoc=ActiveDocument.FullName
mailmsg.Attachments.Add attdoc, olByValue, atpos, "document"
~
The code runs without an error, but the attachment isn't in the e-mail.
Any ideas? I do have a ref to the Outlook reference library. Tag: VBA code to tell you who has a file open Tag: 86268
Toolbar Hell
Help, I'm in Toolbar Hell. I've been working on creating a Toolbar
that floats on top or docks per the user's choice. My experimental
Toolbar is named MacroXToolbar and contains the code that I showed in
my previous post, "CoolBar or MacroX Code for Floating Toolbar?" This
code was in my Normal.dot file, which shows up in the IDE as New
Macros. I dutifully saved via cut'n'paste all the code from New
Macros in text files so that it would be easy to revert back to a
previous version of Normal.dot.
Now I'm getting a bunch of grief anyway, and restoring to a previous
New Macros state doesn't help. When I right click on Word's regular
toolbar to see what toolbars are available, MacroXToolbar is listed
numerous times. All these dupe toolbars are there even if I
completely comment out all the code I was using in
Normal.dot/NewMacros.
I clicked on: Tools ===> Customize ===> Toolbars tab, and then
scrolled down and deleted every occurrence of MacroXToolbar. That
worked while I was in the Word document, but as soon as I exited and
restarted Word, they were all back again. I even tried uninstalling
and reinstalling Word. No luck.
I get the k'zillion MacroXToolbars even if all the code I was using is
completely removed from New Macros, so obviously these multiple
nuisance toolbars are saved somewhere where I didn't realize I was
saving them.
If I hit Tools ===> Templates and Add-ins and then uncheck everything
there, I STILL get the phantom MacroXToolbars. And, btw, if I bring
up one of these toolbars and then click on it, nothing happens, which
is to be expected since I've commented out all the code.
Obviously there's something I'm missing. I inadvertently created this
monster, and would be very grateful for any tips offered on how to
slay it. Tag: VBA code to tell you who has a file open Tag: 86265
How do I get the XML-features of WORD2003 activated in SE?
Dear all!
MS advertises the new XML-features of WORD2003. Unfortunately, in the
footnotes they clarify, that these features are only available for WORD2003
bought on its own or with the Professional Edition. I wonder, if there is no
way to get these features working with a Standard Edition.
Many thanks for your help in advance!
Reinhold Tag: VBA code to tell you who has a file open Tag: 86263
Word is sluggish
Word is sluggish. It is trying to do something in the background that slows
me donw.
For example: I am working in a five-page document with a few embedded
pictures and Word is just sluggish. Evrytime I type something in, it starts
crunching something in the background; I can not see the place holder until
Word has finished whatever it is doing.
While Word is stalling, one can see a little book icon turning its pages on
the left of the status bar at the bottom. When Word is finished whatever it
was doing, a red cross appears over the book.
I would like to stop this process, but I do not know how. I tried right
click on the book icon, and it opened the spell check options. But unchecking
the spell/grammar checks did not resolve the issue.
I opened the Windows Task Manager and I see WINWORD.EXE taking up ~50% of
the CPU activity (the other ~50% are taken by the System idle process).
Can any body help me to regain control of this runaway Word?
Thanks, Victor G. Tag: VBA code to tell you who has a file open Tag: 86261
access the numbering on document with ActiveDocument.Sections(1).r
Hello - I am a newbie.. so this might be an easy question! I want a variable
to have a value that represents an all text version of the activedocument.
This is what I am currently using to assign the value to the variable:
ActiveDocument.Sections(1).Range
That works just fine... except it excludes the numbering from the document.
I really need the numbering to be in the text. How would I do that. It
seems to me that this should maybe do it:
JavaScriptArray = ActiveDocument.Lists(1).Range.ListFormat
or this..
JavaScriptArray = ActiveDocument.StoryRanges(wdMainTextStory)
Or some variation of one of the three. They ALL exclude the numbering. I
have feverishly searched for a solution. Please bail me out!
--
Thanks,
Mike Tag: VBA code to tell you who has a file open Tag: 86260
Problem with word.activedocument.save at secure urls
Hi,
Pardon and redirect me if this is not the correct group.
We need to save a word doc to a server url. We have written a macro
which uses word.activedocument.save to save it. I know this needs front
page extensions to be installed on the iis and we have ensured its
presence. We are able to save to server when url is simple http -
however it fails with error:#5096 when the url is https.
Does word.activedocument.save have any limitation? Is there any
solution/workaround for this?
Thanks,
Piyush Tag: VBA code to tell you who has a file open Tag: 86259
Delete only picture in the header
Hi
I want to use vba to delete only picture in the header.
Lines an other shapes shoud not be deleted.
Maybe somebody can send me the right code for this work.
Thank you
Mitterbuchner Stefan Tag: VBA code to tell you who has a file open Tag: 86253
Msgbox--Sound
Hi,
Does anyone know how set up Msgbox so it makes a sound (e.g. a beep)
when it is displayed.
Thanks,
Mark Tag: VBA code to tell you who has a file open Tag: 86252
how to allow tracking changes&comments in protected mode
Hi made Template, where user cannot change 1st page and header and footer.
I protected this Doc with Filling in Forms protection.
But I totally forgot about "track changes" and "comments" is there a
posibility to allow user to track changes and insert comments in protected
mode.
Thanks for Help. Tag: VBA code to tell you who has a file open Tag: 86249
Prevent loading Toolbar Macro at Startup
Would someone please tell me how to turn off a macro that loads a toolbar
item at startup in Word 2003? I can hide the (Test Director) toolbar at
startup however @ startup it gives a Security Warning about TestDirector.dot
containing Macros. I'd like to set startup to not load TestDirector. I'd
like to load manually if necessary after start up.
Thx,
Ted Tag: VBA code to tell you who has a file open Tag: 86246
Macro Names
Is there a way of listing all the macro names in a document?
I have code which loops through opening every document in a given directory,
but how do I list the macros? Tag: VBA code to tell you who has a file open Tag: 86245
Making a New Document Active
I have this code from an 'OK' button on a form which simply allows the user
select to create a New Blank Document, or insert other types of files. The
problem area is inserting the new blank document because I need to become the
active document. So whatever other documents are open at the time, they need
to remain open and go to the background, and the new blank document has to
become active.
Can anyone help with the correct code I need to use and where to use it?
Thanks
=======================================
Private Sub btnOK_Click()
Dim Today As String, FirstInit As String, Name As String, Dir As String,
ChangeDir As String
Dim NewDoc As Byte
ChangeDir = Me.lbxProfessionals.Value
Today = " "
FirstInit = ChangeDir
Name = Application.UserInitials
Order = " "
Dir = "G:\" & ChangeDir & "\"
MakeFileName Today, FirstInit, Order, Dir
Name = Dir & Today & "_" & Name & Order & ".doc"
Select Case Choice
Case 0
Application.ChangeFileOpenDirectory "F:\TEMPLATES"
Documents.Add Template:="Document", NewTemplate:=True
Case 1
Case 2
Case Else
End Select
With Application.Dialogs(wdDialogFileSaveAs)
.Format = wdFormatDocument
End With
If ActiveDocument.SaveFormat = wdFormatTemplate Then
ActiveDocument.SaveAs FileFormat:=wdFormatDocument
End If
ActiveDocument.SaveAs FileName:=Name, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
Call CreateFooter
Selection.WholeStory
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdMove
Unload Me
End
End Sub
=======================================
Thanks again Tag: VBA code to tell you who has a file open Tag: 86244
Page number of endnote
Hi,
In Word VBA, how could i find out the page number of a endnote?
thank you,
Ruslan. Tag: VBA code to tell you who has a file open Tag: 86241
Program with Borders in Style object (Word)
Hi,
I am not sure rather I post in the right newgroup. If not, can anyone
tell me where I should post this question. Thanks.
I have trying to write a program in C# which extracts all the formatting
styles form a word document. However I got a problem with extracting paragpah
borders defined for a style. I have defined a style called "Note[Deanger]",
for this style, I have set the "Border Setting" to Box. When I run my
program, I use the following codes to extract the border style:
Word.Style style = wordDoc.Styles.Item("Note[Danger]");
border = style.Borders.Item(Word.WdBorderType.wdBorderTop);
the above code does return the correct border object to me, however, the
border does not contains any information about LineStyle, Color etc. Does
aynone know why it is like this? the Word.WdBorderType.wdBorderRight,
Word.WdBorderType.wdBorderLeft, Word.WdBorderType.wdBorderBottom all have the
same problem. Tag: VBA code to tell you who has a file open Tag: 86232
Stopping AutoClose macro
I have put code in the AutoClose macro to check if a bookmark exists. If it
doesn't I throw up an error messagebox. However, when they OK the message
box, I want to cancel the autoclose so the document stays open. Exit Sub
doesn't work.
Any ideas please?
Stephen Tag: VBA code to tell you who has a file open Tag: 86230
replace unknown characters in a variable
Hello - I used the following to set a variable equal to a whole document:
WholeDocumentString = ActiveDocument.Sections(1).Range
That works just fine... but I need to remove all non whitespace and all
non-keyboard characters. I use this:
WholeDocumentString = Replace(JavaScriptArray, Chr(9), " ")
WholeDocumentString = Replace(JavaScriptArray, Chr(10), " ")
WholeDocumentString = Replace(JavaScriptArray, Chr(13), " ")
That works fine for linefeeds, carriage returns, and tabs. But there are
still some unknown characters from a table. These characters occur where the
table columns are located. How do I replace those with a space?
--
Thanks,
Mike Tag: VBA code to tell you who has a file open Tag: 86225
Recording Data from a VBA macro
Hi,
I have a macro with many userforms and have some code that records whether
each checkbox or optionbutton was selected. This data is then stored as a
string called MIDATA and added to a text file (and then this text file is
linked into an Access database)
The problem I have is that if 2 people run the code at exactly the same
file, the text file is ready-only. Is there a better way to record the data
in a file that can be accessed by multiple people. My code at the moment
is:
ChangeFileOpenDirectory _
"J:\MACRO MI\"
Documents.Open FileName:="MacroMI.txt"
Documents("MacroMI.txt").Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText Text:=MIDATA
If ActiveDocument.ReadOnly = False Then
ActiveDocument.Save
End If
ActiveDocument.Close
I have thought about having some 'other' text files that the code can go to
if the main one is 'read-only', but this seems messey
Thanks for any help or pointers. Tag: VBA code to tell you who has a file open Tag: 86220
Format a date using VBA
Can anyone tell me how or point to something that shows me how to indicate
the format I wish a date to appear in the document for a date obtained via
input into a userform. I have various dates that need to appear in different
formats within the document.
thanks...
--
singeredel (Julie) Tag: VBA code to tell you who has a file open Tag: 86209
Inserting text at a specific point via VBA?
I am trying to enter a name into set locations in my document. The
document has [Insert Name Here] blocking the location out. I want to
insert the name there, then have the document adjust the spacing in
that area so there is not a large blank space if the name is short.
Thanks! Tag: VBA code to tell you who has a file open Tag: 86205
Retrieving Page Properties in a Protected Document
Is there a way to programatically retrieve the page orientation on a
protected document?
I have a protected document. I need to obtain it's page orientation ie.
portrait or landscape. Then my code changes the zoom to optimize viewing.
When I try to programatically retrieve the page properties (to determine the
page orientation) I get an error, stating that the page properties are
unavailable because the document is protected.
I would prefer NOT to unprotect then reprotect the document to resolve this.
Thanks for reading.
Stuart
Sydney, AUSTRALIA Tag: VBA code to tell you who has a file open Tag: 86197
Word 2000 Print Events
Hi,
I am using Visual Studio.net 2003 with Word 2000 to automate the printing of
several documents. I have run into a problem where I need to close the
current document after it has been printed, but the document is being closed
before it has been sent to the printer (see code sample below). I really need
some sort of AfterPrint event to clean up after the document has been
printed, but the Word object model does not expose an AfterPrint event. Is
there another event or property I could use which would be suitable for this?
The only alternative I can think of is to introduce a pause of a few seconds
to give the document time to spool.
Any advice would be much appreciated.
Code sample:
mobjWord.ActiveDocument.PrintOut() ' Print letter
mobjWord.ActiveDocument.Close(WdSaveOptions.wdDoNotSaveChanges) ' Close
current document
RaiseEvent DocumentClosed(Me, New System.EventArgs()) ' Raise event to client
mobjWord.Quit(0,0) ' Close Word
RaiseEvent Disposed(Me, New System.EventArgs()) Tag: VBA code to tell you who has a file open Tag: 86196
use of "auto-correct" to speed up typing.
As a lawyer, I use the auto-correct facility to speed up typing, by putting
two or three letter abbreviations for much longer words or phrases, such as
"ic" for "Information Commissioner", or "ccc" for the name of the current
client I am doing some work for. It would be more useful if particular
abbreviations could be confined to particular files or sub-directories, so
that, say, the same abbreviation "ccc" could be used to mean something else
when I was working on a different case whose documents I store in a different
sub-directory.
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/community/en-us/default.mspx?mid=f31e5927-1efb-491d-b556-0dbfdc6865ec&dg=microsoft.public.word.vba.general Tag: VBA code to tell you who has a file open Tag: 86192
Getting all the text from a set of inline shapes.
Hi, I am having trouble finding a way to get the text from a set of inline
shapes... I can do this no problem under powerpoint, but word's shape model
appears to be different... (ie HasTextFrame is missing etc)
When I have tried to use the range option I just get a null back... Has
anyone else done this before (word2k3)
For Each myPic in appWord.ActiveDocument.InlineShapes
shapeText = .....
Next myPic
Thanks in advance
Simon Tag: VBA code to tell you who has a file open Tag: 86190
How to close embedded workbook properly
Hello!
1. I create new MS Word 2003 document.
2. Add reference to Excel.
3. Insert embedded Excel object.
4. Run the following code:
Function OpenAndCloseExcel()
Dim objWorkBook As excel.Workbook
Dim objExcel As excel.Application
ActiveDocument.InlineShapes(1).OLEFormat.DoVerb
VerbIndex:=wdOLEVerbPrimary
Set objWorkBook = ActiveDocument.InlineShapes(1).OLEFormat.Object
Set objExcel = objWorkBook.Application
objWorkBook.Close
objExcel.Quit
End Function
Function fails - error 1004, method 'close' of object '_workbook' failed.
5. I run the same function again, Excel objext already activated on step 4.
Function does not fails, Excel removed from task manager.
Could you, please, describe
1. Why function fails on step 4?
2. How to close embedded workbook & excel application properly?
Thank you very much in advance. Tag: VBA code to tell you who has a file open Tag: 86187
CoolBar or MacroX Code for Floating Toolbar?
I'm writing utility for Word that needs to have a floating and
dockable toolbar. A regular form won't do the trick because the gizmo
is pretty much useless unless the user can edit his/her document while
this toolbar either floats or is docked at the top. This toolbar will
have a few buttons and a combo box from which the user will select
what commands to run.
I've used the Toolbar together with the ImageList ActiveX control
extensively in regular VB 6, but I've never used the Coolbar control.
I've skimmed MSDN and O'Reilly's VB Controls in a Nutshell, and it
appears that you use the inside of the Coolbar to put whatever buttons
you want to onto your floating toolbar, and that the Coolbar is what
allows you to make your toolbar floating or docked.
I have code from a previous VB project that contains subs that help
the user to remove or add buttons to and from a Toolbar. So, is it a
slam dunk that the best approach is for me to use the Toolbar, the
ImageList, and the Coolbar for my VBA project? That's what I'm unsure
about.
First, I'd like to know if there are any gotchas when using ActiveX
controls in VBA. I've only used them in regular VB. Second, I'm
wondering if it's feasible to create this thing without any ActiveX
controls. I searched the news group's archives for "floating toolbar"
and found some code that creates a floating and dockable toolbar with
what is intrinsically available in VBA. (I'm posting it at the end of
this message.)
I'm intrigued. Is it somehow possible to use this code I've found to
programattically instantiate buttons and a ComboBox? If so, what
MSDN/archive search/3rd party VBA material do I need to be reading up
in so that I can get a solid understanding on how to do this?
Or am I better off doing the Toolbar/ImageList/Coolbar thing? I
appreciate any help offered.
cheers,
Tom
The Code:
Option Explicit
Public Sub AutoExit()
'Runs whenever MacroX is unloaded as a global template, or when
'Word exits
'Removes the toolbar
On Error Resume Next
'remove the toolbar if it is still there
CommandBars("MacroXToolBar").Delete
End Sub
Public Sub AutoExec()
'Runs whenever MacroX is loaded as a global template
'Creates the MacroX toolbar
Dim cbb As CommandBarButton
On Error Resume Next
'delete the command bar in case it already exists
CommandBars("MacroXToolBar").Delete
'create toolbar and add a button
On Error GoTo 0
CommandBars.Add("MacroXToolBar").Visible = True
Set cbb = _
CommandBars("MacroXToolBar").Controls.Add _
(Type:=msoControlButton, Before:=1)
With cbb
.Caption = "MacroX"
.FaceId = 630 'a picture for the button, pick any one you
like
.OnAction = "SetUpMacroX"
.Style = msoButtonIconAndCaption 'or choose just to display
Caption
End With
End Sub
Public Sub AutoOpen()
'Executes whenever MacroX is opened
Call AutoExec
End Sub
Public Sub AutoClose()
Call AutoExit
End Sub Tag: VBA code to tell you who has a file open Tag: 86185
word.basic
Hello
I need to modify an old program, which creates a .doc file, using the model
"word.basic" (MS Word 95) instead of "word.application" But I can't find the
properties or methods of that model. Today, the program is very simple and
only inserts text:
oWord = CreateObject("Word.Basic")
...
...
oWord.Insert("Text......")
But what I need is to align that text (Left, Center, Right, Justify) and
make some other changes
Thanks Tag: VBA code to tell you who has a file open Tag: 86175
macro to change to another font
I've used vba, but never with word. I usually work with Arial or Times
fonts. I do a lot of music theory writing, so I need to use Yo Tomita's
bach font for characters. I would like to streamline the process of
changing the font and returning to the original font, often with the
next character. For instance, if I want to describe and E-flat chord, I
would like to type "E" then perhaps [alt-z] which changes the font to
bach, @ (which gives me the flat sign) then [alt-x] to return to the
orignal font.
Seems like two separate keyboard-shortcut macros to me. Should I be
looking at this another way?
Andy Tag: VBA code to tell you who has a file open Tag: 86174
Shared Outlook 2003 Contacts
We are updating our letterhead template and now have code to insert
names/addresses from the user's Contacts folder. However, we'd like to be
able to access shared contacts -- for instance, if an attorney has given his
secretary access to his/her Contacts folder. Is this possible, if so please
provide sample code. Thank you. Tag: VBA code to tell you who has a file open Tag: 86173
Can I do this in a toolbar?
Hi -- There are a couple of page set up settings that I would like to be able
to see on a toolbar for any document I am in -- the page size (e.g. letter or
A4) and the paper tray source for printing. Would be extra cool if I could
use the buttons to change the settings as well, like with a drop-down list,
similar to changing font size or that kind of thing.
Closest thing I can find in the standard buttons is the "page setup" button,
but I can't find any standard buttons for the individual settings in the page
setup area.
Even if the button could just display the current info, and then I'd have to
click the page setup button if I needed to change the settings, that would be
helpful.
Thanks in advance for any ideas anyone can offer! Tag: VBA code to tell you who has a file open Tag: 86170
Waiting for Document to load
I am creating a word document that basically analyzes other word
documents that contain UAT test resuts (versus putting a button and
code on hundereds of documents). This should be done in VB.NET or
something along those lines, but licensing is an issue. My problem
lies when a document is opened up that takes a bit to load but the code
does not wait and executes before it is finished loading, giving
completely bogus results.
Here is the run down:
User selects which file to analyze using a dialog box, which
unfortunately does nothing else:
Application.Dialogs(wdDialogFileOpen).Show
<document starts to load>
<"freezes" document loading and executes code, giving bogus data>
<document finishes loading>
<user gets confused>
I would like a way to wait for the document to finish loading before
the analyzing code is executed.
Thanks! Tag: VBA code to tell you who has a file open Tag: 86168
excel linking collating data into one workbook
Hi I want to know how to link specific cell references of various files
residing in different folders in a location onto a new workbook.
can someone help by providing a simple solution of just specifying the
file name in a particular cell of a new workbook and linking up the
specified cells that exist across various files residing in different
folders in a location by way of a formula? Tag: VBA code to tell you who has a file open Tag: 86160
Using Asc and Chr
This is an ongoing issue in the Document Management group and I wanted
to bring it up here in hopes of getting the right people engaged.
If I insert any one of the ten "arrow" symbols using
Insert>Symbol>Symbols>Font Symbol and run the following code with any
one of theses symbols selected it returns a value of 40 and inserts a
left side paren symbol:
Sub Test()
Dim pAsc As Long
pAsc = Asc(Selection)
Selection.Range.InsertAfter Chr(pAsc)
End Sub
Why does this happen?
The question in the Documanagement group is how do you get the correct
ASCII code for symbols?
Thanks. Tag: VBA code to tell you who has a file open Tag: 86155
Row Height in table
I have a table in a Word which can have a variable no of rows. As the data in each cell varies the row height
can also vary.
How can I determine when the table has spilled over onto a new page? I then need to generate a new header for
that page.
Nirmal Singh Tag: VBA code to tell you who has a file open Tag: 86150
Fighting Schroedinbug in Word VBA (Tables, images & cie...)
Hi all,
For the last few days, I have been trying to debug some VBA code and it
is driving me crazy. I'm writting an Excel macro which builds (using
CreateObject) a Word document in background. The document is displayed
at the end of the generation process.
One of the most strange behavior I've noticed is the fact that
everything seems right when I run the code step-by-step in the Visual
Basic editor, but it is screwed up if I execute the macro normally.
For example, I have a sub which insert a table in the document. The
table is supposed to be aligned on the right and be 8 centimeter wide.
If I execute the code step-by-step, displaying the document to watch
the process, the tables will be formatted perfectly. However, if I run
the macro and let the document invisible, the tables will be page wide
and aligned on the left.
The executed code is below:
With MeterTable
.Rows.WrapAroundText = True
.Rows.AllowOverlap = False
.Rows.Alignment = wdAlignRowRight
.PreferredWidthType = wdPreferredWidthPoints
.PreferredWidth = Application.CentimetersToPoints(8.26)
End With
Even better: To tackle this bug, I have tried to add a small loop at
the end of the main macro. the code is below:
For Each aTable In WordDocument.Tables
aTable.Rows.Alignment = wdAlignRowRight
aTable.PreferredWidthType = wdPreferredWidthPoints
aTable.PreferredWidth = Application.CentimetersToPoints(8.26)
Next aTable
WordApplication.Visible = True
' End of the macro
If I do it, the tables are 8.26 centimeter wide, but they are still
aligned on the left !
I have the same kind of problem with images I want to put in the
background of the table: when I am debugging the code, the image fits
perfectly, while it is put in the top left corner of the page if I run
the macro.
Can someone help me, please?! These bugs seem supernatural to me.
-- Ben Tag: VBA code to tell you who has a file open Tag: 86149
Word 2003 (English version) DLLs and Word 2003 (German version) DL
Hi,
I have created a Word Style Extractor to extract formatting styles
from Word document. This application is created using VS 2002 (English
version) and used the Microsoft Office 11.0 Object Library (office.dll
English version).
If the application compiled with the Microsoft Office 11.0 Object
Library (office.dll English version) reference, will the application work
when it is installed to the machines that has Word 2003 (German version)? Tag: VBA code to tell you who has a file open Tag: 86142
fit drawing to contents
I need to use the Fit Drawing to Contents function (availabe in the
Drawing Canvas toolbar that I get when I right click a picture and
select Edit Picture) in a macro. I tried to record the operation and
copy the command from the recorded macro, but the recorded macro was
empty.
Does it mean that no VBA command is available for this function? Tag: VBA code to tell you who has a file open Tag: 86132
Capturing the name of each optionbutton and checkbox in userform
Hi
I have a userform (called 'ReqsFrm') that contains loads of optionbuttons
and checkboxes
I would like to create some code that writes the name/caption of each of the
elements of the form. Now I can do it by manually producing the code, but
I'm sure there must be some sort of looping code that will do it for me. So
I'm trying do to something like:
Dim OB as OptionButton
For each OB in ReqsFrm
Type name of OptionButton
Type caption of OtionButton
Next OB
and then the same for the checkboxes
Can anyone help.
Thanks Tag: VBA code to tell you who has a file open Tag: 86122
changing without ending
I can write macro which works in this way:
1) choose an image
2) change size and position
3) close UserForm
but more useful will be macro working in this way:
1) run macro
2) open UseForm
3) choose an image
4) change size and position
5) choose next image
6) ....
Is it possible?
Greg Tag: VBA code to tell you who has a file open Tag: 86115
I am over mind head
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C67BA7.47B95140
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Sensei's
After many hours of trial and tribulation, I have reached the limit of =
my skills and seek your assistance. I am working on a macro to add a =
new row to a table in a protected form on exit from the last column/last =
row of the field of the table. I am *almost* successful if the cells of =
the table only contain one formfield. I am trying to enhance this =
general macro to duplicate a row if it contains more that one formfield. =
I am close as it the preceeding row contains a text field then a =
checkbox I can create a new row with a text field and checkbox but the =
problem I am having is the checkbox in the new row is before the text =
field.
Here is the code so far:
Sub Addrow()
Dim rownum As Long, i As Long, j As Long, x As Long, y As Long
Dim oRng As Word.Range
Dim pListArray() As String
Dim pType As String
Dim pExit As String
Dim pEntry As String
Dim pEnabled As Boolean
Dim pCalcOnExit As Boolean
Dim pDefText As String
Dim pDefCheck As Boolean
Dim pStatusText As String
Dim pHelpText As String
Dim oRgField As FormField
Dim myField As FormField
Dim oTbl As Table
Set oTbl =3D Selection.Tables(1)
ActiveDocument.Unprotect
oTbl.Rows.Add
rownum =3D oTbl.Rows.Count
For i =3D 1 To oTbl.Columns.Count
'Set oRng =3D oTbl.Cell(rownum, i).Range
'oRng.Collapse wdCollapseStart
y =3D oTbl.Cell(rownum - 1, i).Range.FormFields.Count
For x =3D 1 To y
Set oRgField =3D oTbl.Cell(rownum - 1, i).Range.FormFields(x)
With oRgField
pType =3D .Type
pExit =3D .ExitMacro
pEntry =3D .EntryMacro
pEnabled =3D .Enabled
pDefText =3D .TextInput.Default
pCalcOnExit =3D .CalculateOnExit
If .Type =3D wdFieldFormCheckBox Then
pDefCheck =3D .CheckBox.Default
End If
pStatusText =3D .StatusText
pHelpText =3D .HelpText
End With
Select Case pType
Case wdFieldFormDropDown
Set oRng =3D oTbl.Cell(rownum, i).Range
oRng.Collapse wdCollapseStart
Set myField =3D ActiveDocument.FormFields.Add(Range:=3DoRng, _
Type:=3DwdFieldFormDropDown)
With myField
.ExitMacro =3D pExit
.EntryMacro =3D pEntry
.Enabled =3D pEnabled
.CalculateOnExit =3D pCalcOnExit
.StatusText =3D pStatusText
.HelpText =3D pHelpText
End With
For j =3D 1 To oTbl.Cell(rownum - 1, =
i).Range.FormFields(1).DropDown.ListEntries.Count
ReDim Preserve pListArray(j)
pListArray(j) =3D oTbl.Cell(rownum - 1, =
i).Range.FormFields(1).DropDown.ListEntries(j).Name
Next j
For j =3D 1 To UBound(pListArray)
myField.DropDown.ListEntries.Add pListArray(j)
Next j
'oRng.Collapse wdCollapseStart '*************
Case wdFieldFormTextInput
Set oRng =3D oTbl.Cell(rownum, i).Range
Set myField =3D ActiveDocument.FormFields.Add(Range:=3DoRng, _
Type:=3DwdFieldFormTextInput)
With myField
.ExitMacro =3D pExit
.EntryMacro =3D pEntry
.Enabled =3D pEnabled
.TextInput.Default =3D pDefText
.Result =3D pDefText
.CalculateOnExit =3D pCalcOnExit
.StatusText =3D pStatusText
.HelpText =3D pHelpText
End With
'oRng.Collapse wdCollapseStart '*************
Case wdFieldFormCheckBox
Set oRng =3D oTbl.Cell(rownum, i).Range
Set myField =3D ActiveDocument.FormFields.Add(Range:=3DoRng, _
Type:=3DwdFieldFormCheckBox)
With myField
.ExitMacro =3D pExit
.EntryMacro =3D pEntry
.Enabled =3D pEnabled
.CalculateOnExit =3D pCalcOnExit
.CheckBox.Default =3D pDefCheck
.StatusText =3D pStatusText
.HelpText =3D pHelpText
End With
'oRng.Collapse wdCollapseStart '*************
End Select
Next x
Next i
oTbl.Cell(oTbl.Rows.Count, 1).Range.FormFields(1).Select
ActiveDocument.Protect Type:=3DwdAllowOnlyFormFields, NoReset:=3DTrue
End Sub
All you have to do is create a one row multicolumn table with fiels and =
Addrow set to run on exit from the last field.
--=20
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
------=_NextPart_000_000C_01C67BA7.47B95140
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#f8f2d6>
<DIV>Hi Sensei's</DIV>
<DIV> </DIV>
<DIV>After many hours of trial and tribulation, I have reached the limit =
of my=20
skills and seek your assistance. I am working on a macro to add a =
new row=20
to a table in a protected form on exit from the =
last column/last=20
row of the field of the table. I am *almost* successful if the cells of =
the=20
table only contain one formfield. I am trying to enhance this =
general=20
macro to duplicate a row if it contains more that one formfield. I =
am close=20
as it the preceeding row contains a text field then a checkbox I =
can create=20
a new row with a text field and checkbox but the =
problem I=20
am having is the checkbox in the new row is before the text field.</DIV>
<DIV> </DIV>
<DIV>Here is the code so far:</DIV>
<DIV> </DIV>
<DIV> Sub Addrow()<BR>Dim rownum As Long, i As =
Long, j As=20
Long, x As Long, y As Long<BR>Dim oRng As Word.Range<BR>Dim pListArray() =
As=20
String<BR>Dim pType As String<BR>Dim pExit As String<BR>Dim pEntry As=20
String<BR>Dim pEnabled As Boolean<BR>Dim pCalcOnExit As Boolean<BR>Dim =
pDefText=20
As String<BR>Dim pDefCheck As Boolean<BR>Dim pStatusText As =
String<BR>Dim=20
pHelpText As String<BR>Dim oRgField As FormField<BR>Dim myField As=20
FormField<BR>Dim oTbl As Table<BR>Set oTbl =3D=20
Selection.Tables(1)<BR>ActiveDocument.Unprotect<BR>oTbl.Rows.Add<BR>rownu=
m =3D=20
oTbl.Rows.Count<BR>For i =3D 1 To oTbl.Columns.Count<BR> 'Set oRng =
=3D=20
oTbl.Cell(rownum, i).Range<BR> 'oRng.Collapse =
wdCollapseStart<BR> y=20
=3D oTbl.Cell(rownum - 1, i).Range.FormFields.Count<BR> For x =3D =
1 To=20
y<BR> Set oRgField =3D oTbl.Cell(rownum - 1,=20
i).Range.FormFields(x)<BR> With=20
oRgField<BR> pType =3D=20
.Type<BR> pExit =3D=20
.ExitMacro<BR> pEntry =3D=20
.EntryMacro<BR> pEnabled =3D=20
.Enabled<BR> pDefText =3D=20
.TextInput.Default<BR> pCalcOnExit =3D=20
.CalculateOnExit<BR> If .Type =3D=20
wdFieldFormCheckBox Then<BR> =
pDefCheck=20
=3D .CheckBox.Default<BR> End=20
If<BR> pStatusText =3D=20
.StatusText<BR> pHelpText =3D=20
.HelpText<BR> End With<BR> Select =
Case=20
pType<BR> Case=20
wdFieldFormDropDown<BR> Set =
oRng =3D=20
oTbl.Cell(rownum, i).Range<BR> =
oRng.Collapse =
wdCollapseStart<BR> Set=20
myField =3D ActiveDocument.FormFields.Add(Range:=3DoRng,=20
_<BR> &n=
bsp; =20
Type:=3DwdFieldFormDropDown)<BR>  =
; With=20
myField<BR> =
.ExitMacro =3D=20
pExit<BR> =
.EntryMacro =3D=20
pEntry<BR> =
.Enabled =3D=20
pEnabled<BR> =20
.CalculateOnExit =3D=20
pCalcOnExit<BR> =20
.StatusText =3D=20
pStatusText<BR> =
.HelpText=20
=3D pHelpText<BR> End=20
With<BR> For j =3D 1 To =
oTbl.Cell(rownum=20
- 1,=20
i).Range.FormFields(1).DropDown.ListEntries.Count<BR> &n=
bsp; =20
ReDim Preserve=20
pListArray(j)<BR> =20
pListArray(j) =3D oTbl.Cell(rownum - 1,=20
i).Range.FormFields(1).DropDown.ListEntries(j).Name<BR> =
=20
Next j<BR> For j =3D 1 To=20
UBound(pListArray)<BR> &nb=
sp;=20
myField.DropDown.ListEntries.Add=20
pListArray(j)<BR> Next=20
j<BR> 'oRng.Collapse =
wdCollapseStart=20
'*************<BR> Case=20
wdFieldFormTextInput<BR> Set =
oRng =3D=20
oTbl.Cell(rownum, i).Range<BR> =
Set=20
myField =3D ActiveDocument.FormFields.Add(Range:=3DoRng,=20
_<BR> =20
Type:=3DwdFieldFormTextInput)<BR> &nbs=
p; With=20
myField<BR> =
.ExitMacro =3D=20
pExit<BR> =
.EntryMacro =3D=20
pEntry<BR> =
.Enabled =3D=20
pEnabled<BR> =20
.TextInput.Default =3D=20
pDefText<BR> =
.Result =3D=20
pDefText<BR> =20
.CalculateOnExit =3D=20
pCalcOnExit<BR> =20
.StatusText =3D=20
pStatusText<BR> =
.HelpText=20
=3D pHelpText<BR> End=20
With<BR> 'oRng.Collapse=20
wdCollapseStart '*************<BR> Case=20
wdFieldFormCheckBox<BR> Set =
oRng =3D=20
oTbl.Cell(rownum, i).Range<BR> =
Set=20
myField =3D ActiveDocument.FormFields.Add(Range:=3DoRng,=20
_<BR> =20
Type:=3DwdFieldFormCheckBox)<BR>  =
; With=20
myField<BR> =
.ExitMacro =3D=20
pExit<BR> =
.EntryMacro =3D=20
pEntry<BR> =
.Enabled =3D=20
pEnabled<BR> =20
.CalculateOnExit =3D=20
pCalcOnExit<BR> =20
.CheckBox.Default =3D=20
pDefCheck<BR> =
.StatusText=20
=3D =
pStatusText<BR> =20
.HelpText =3D pHelpText<BR> =
End=20
With<BR> 'oRng.Collapse=20
wdCollapseStart '*************<BR> End=20
Select<BR> Next x<BR>Next =
i<BR>oTbl.Cell(oTbl.Rows.Count,=20
1).Range.FormFields(1).Select<BR>ActiveDocument.Protect=20
Type:=3DwdAllowOnlyFormFields, NoReset:=3DTrue<BR>End Sub<BR></DIV>
<DIV>All you have to do is create a one row multicolumn table with fiels =
and=20
Addrow set to run on exit from the last field.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>-- <BR>Greg Maxey/Word MVP<BR>See:<BR><A=20
href=3D"http://gregmaxey.mvps.org/word_tips.htm">http://gregmaxey.mvps.or=
g/word_tips.htm</A><BR>For=20
some helpful tips using Word.<BR></DIV></BODY></HTML>
------=_NextPart_000_000C_01C67BA7.47B95140-- Tag: VBA code to tell you who has a file open Tag: 86113
name field in template to repeat thru document
I would like to create place holders in a template, for client names in
reports/documents that I could enter their name once and it would update each
placeholder occurance. Tag: VBA code to tell you who has a file open Tag: 86110
Combo Box problems again
This is my first time creating Combo Boxes in Word 2003. I have about 30
combo boxes created in a document. I am able to select an item in the combo
box if I type the first letter of the item. I am not able to select an item
by clicking on the item with my mouse. Do I have something set wrong on the
properties? Tag: VBA code to tell you who has a file open Tag: 86095
Hi,
Is there some VBA code that can tell me which user is in a file if it is
'read-only' when I open it?