Automatic response in Word, based on entered data?
I have a table in my document that has 3 columns of data, 2 are entered by
the user, and the third column will be automatically filled, based on what
was entered in the first 2. For example if the data was "rare" and
"insignificant" in the first and second column, then the third column should
return "LOW" Tag: why my microsoft word is lock Tag: 113681
ContentControlOnExit
Hi,
I have some new ContentControls in my Word2007 Document. I can add and
change Text with VBA code.
But I cannot catch a change in the ControlFields with ContentControlOnExit.
Can someone please guide me into the right dircection with some sample lines
of VBA Code?
Tanks in Advance
Hans Tag: why my microsoft word is lock Tag: 113679
search and replace all colors except red
Hi
I am working on a Word 2003 macro to make a series of text replacements
across a wide variety of documents with different styles. I am turning
revision marks on, so I know that text that I have already changed in a
previous search-and-replace operation will become red with single
strikethrough. If the macro has already changed the text, it shouldn't
replace it again -- the macro should operate on all formats *except* red and
single-strikethrough text.
.font.color = NOT wdColorRed
The above isn't the right approach..appears to be doing a bitwise not and
coming up with an invalid color value. Any suggestions?
Thanks
JQ
--
John Q. Murray
Executive Director
Corporation for Public Community Newspapers Tag: why my microsoft word is lock Tag: 113674
Update fields in footers
I have this macro which updates the fields in the footer. I doubt it is the
best way to make this happen...also it doesn't work in all sections. Any
advice would be appreciated! Thanks
If Documents.Count = 0 Then Exit Sub
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument Tag: why my microsoft word is lock Tag: 113669
Combobox problem
I have a combobox on my sheet and I populate it with day numbers 1-31. The
problem is the numbers appear repeated 31 times in the list.
My code is
Private Sub ComboBox1_DropButtonClick()
Dim myArray1 As Variant
Dim myArray2 As Variant
Dim i As Long
myArray1 = Split("0|1|2|3|4|5|6|" _
& "7|8|9|10|11|12|" _
& "13|14|15|16|17|18|" _
& "19|20|21|22|23|24|" _
& "25|26|27|28|29|30|" _
& "31", "|")
With lst01
Me.ComboBox1.ColumnCount = 1
Me.ComboBox1.ColumnWidths = "25"
End With
For i = 0 To UBound(myArray1)
Me.ComboBox1.AddItem
Me.ComboBox1.List(i, 0) = myArray1(i)
Next i
End Sub Tag: why my microsoft word is lock Tag: 113668
Test to see if a document is opened for editing by another user
Hi All
Is there a way I can test to see if a document is opened for editing
by another user before I try to open it?
I would like to be able to make a call to test if my Documents.Open
will be successful and not result in the pop-up "The files is locked
for editing by 'another user'".
Is it possible to test for this? Thanks in advance for any answers.
Chrisso Tag: why my microsoft word is lock Tag: 113667
Replacement text is too long
Hi,
I used the following subroutine to replace some text appearing in a
document, which is the same as that held by TextBox1, by the text held
in TextBox3.
With doc_range.Find
.Text = TextBox1
.Font.Color = wdColorRed
.Replacement.Text = TextBox3
.Replacement.Font.Color = wdColorBlack
.Execute Replace:=wdReplaceAll
End With
For example, I want to replace boy_name in a document, then I'll put
boy_name in TextBox1 in a userform and put the replacement text in
Textbox3. After the replacement, all boy_name(s) in the active
document will be replaced. But, today, a error message showed up
saying that the replacement text, which is the text in TextBox3, is
too long. Can someone tell me how to overcome this problem? Thanks.
Mike Tag: why my microsoft word is lock Tag: 113664
Losing AutoText and Toolbars when converting from MAC to PC
I am in the process of switching from MAC to PC.
I have created numerous templates in Word 2003 on the MAC (9.1) with tons of
customized AutoText and Toolbars. Unfortunately, when I move the templates to
Word 2003 on the PC, all of the customized AutoText and toolbars are not
retained with the template. How do I go about converting the templates in
order to retain the AutoText and Toolbars?
Any help you can provide will be most appreciated.
Thank you,
Kaye Shipley Tag: why my microsoft word is lock Tag: 113661
Organization Chart in Word 2007
I am trying to generate an Org Chart in Word 2007 from my VB.Net
program. I got the code from http://support.microsoft.com/default.aspx?scid=kb;en-us;317293
The code I have in VB.Net is:
Dim oWord As Object, oDiagram As Object, oTopNode As Object,
oNode As Object
Dim tvNode As TreeNode
oWord = CreateObject("Word.Application")
With oWord
.Visible = True
.Documents.Add()
With .ActiveDocument.Shapes
oDiagram = .AddDiagram(1, 10, 15, 400, 475)
End With
End With
oTopNode = oDiagram.DiagramNode.Children.AddNode()
With oTopNode
.TextShape.TextFrame.TextRange.Text =
tvMyTreeView.SelectedNode.Text
End With
For Each tvNode In tvMyTreeView.SelectedNode.Nodes
With oTopNode
oNode = .Children.AddNode()
End With
With oNode
.TextShape.TextFrame.TextRange.Text = tvNode.Text
End With
Next
This works just fine in Word 2003 but in Word 2007 I get an error
saying: The method or operation is not implemented. This error comes
on the AddDiagram line.
Going through the MSDN pages, there is a page that covers changes in
VBA from Office 2003 to Office 2007. This page says that the
AddDiagram method - along with others - has been changed to "Hidden".
There is no further explanation.
If I write the code in VBA from within Word 2007, the IDE shows that
the AddDiagram method does exists, but also gives an error when I try
to execute the method.
Help? Tag: why my microsoft word is lock Tag: 113659
link text box and dropdown
Two fold question requireing an idiots guide.
How do i populate a combo box with a list of numbers?
Is it pssible to multiply the selected number from the combo bow with a
number stored in a text box and auto undate a second text box with the result
i.e. textbox2=combobox1 x textbox1? Tag: why my microsoft word is lock Tag: 113654
Huh? "<file> is locked for editing by 'another user'" but no lock
Hi All,
I have Word VB code that prepares Word files for distribution to our
users. It does two things:
1. add modules to the Word file (using Application.OrganizerCopy)
2. opens the Word file and adds text to headers and footers.
Sub Prepare_File_For_Distribution(sPath As String, sName As String)
' 1. copy module:
Application.OrganizerCopy _
Source:=ThisDocument.Path & Application.PathSeparator &
ThisDocument.Name, _
Destination:=sPath & sName, _
Name:="Destroy_Date_Adder", _
Object:=wdOrganizerObjectProjectItems
' 2. add text
Documents.Open sPath & sName ' <<< problem here
Add_Uncontrolled_Text Documents(sName)
Documents(sName).Close True
End Sub
I am having trouble in between these two steps.
I am sure I am the only person using the files as I am in test/debug
mode yet Windows insists the file is locked. When I attempt to open
the file I get a Windows pop-up saying "<file> is locked for editing
by 'another user'".
I still get the same message even after testing for the ~$<file>
hidden file which I believe is how the locking is implemented by
Windows. I have written code to test for its existence, remove it,
sleep a second and then try again to open the file but to no avail.
Does anyone have any advice on why I am seeing this problem and how
can I work around it?
Thanks in advance for any ideas - I am quite stuck on this problem.
Chrisso Tag: why my microsoft word is lock Tag: 113653
Finding the end of a document after adding a Table
The following code is a mock-up of code which I have implemented in my
project. It creates a "layout" table (here with 3 rows and 3 columns) and
then places a "problem" table in each cell of the "layout" table. In the
actual version, each "layout" table represents a page (with the rows and
columns variable). The next layout table being on the next page. In
implementing this code in my actual project I discovered (after sometime
debugging) that there are three lines of code at the end which if omitted
makes everything erratic. I wonder if someone could tell me why?
In other words, I found my problem, but I'm having a hard time understanding
why it was a problem. My guess is that without adding a paragraph mark after
the layout table, I'm unable to reset my range variable to the next layout
table.
Sub TestTableLayout()
Dim problemRange As Range
Dim oRange As Range
Dim layoutTable As Table
Dim problemTable As Table
Dim nMaxRows As Long
Dim nMaxCols As Long
Dim nLoRow As Long
Dim nLoCol As Long
Dim nIndex As Long
Dim nExtraRow As Long
Dim nRow As Long
nMaxLoRows = 3
nMaxLoCols = 3
nLoRow = nMaxLoRows
nLoCol = nMaxLoCols
Set problemRange = ActiveDocument.Range
'****
'* Run a test for 20 problems
'****
For nIndex = 1 To 20
'****
'* If Layout Table Is Full (or First Time), Add New Layout Table
'****
If nLoRow = nMaxLoRows And nLoCol = nMaxLoCols Then
Set layoutTable = problemRange.Tables.Add(Range:=problemRange,
NumRows:=nMaxLoRows, NumColumns:=nMaxLoCols)
nLoRow = 1
nLoCol = 0
With layoutTable
.Borders.Enable = False
End With
End If
'****
'* Move to Next Layout Table Cell
'****
If nLoCol = nMaxLoCols Then
nLoCol = 1
nLoRow = nLoRow + 1
Else
nLoCol = nLoCol + 1
End If
Set oRange = layoutTable.Cell(nLoRow, nLoCol).Range
oRange.Collapse
'****
'* Create New Problem Table
'****
If nLoRow = nMaxLoRows Then
nExtraRow = 0
Else
nExtraRow = 1
End If
Set problemTable = oRange.Tables.Add(Range:=oRange, NumRows:=(3 +
nExtraRow), NumColumns:=1)
problemTable.Borders.Enable = False
nRow = 1
With problemTable.Cell(nRow, 1).Range
.Text = "Table " & nIndex & " Row " & nRow
End With
nRow = nRow + 1
With problemTable.Cell(nRow, 1).Range
.Text = "Table " & nIndex & " Row " & nRow
End With
nRow = nRow + 1
With problemTable.Cell(nRow, 1).Range
.Text = "Table " & nIndex & " Row " & nRow
End With
If nExtraRow = 1 Then
With problemTable.Cell(nRow + nExtraRow, 1).Range
.Text = ""
End With
End If
'****
'* If Layout Table Is Full, Prepare For New Layout Table
'****
If nLoRow = nMaxLoRows And nLoCol = nMaxLoCols Then
Set problemRange = layoutTable.Range
With problemRange
.MoveEnd wdCharacter, 1
.Collapse wdCollapseEnd
'****
'* Why are the three following lines necessary?
'* Remove the quote mark before the line to see it work properly.
'* Then add the quote mark back to see the code act erratically.
'****
'.InsertParagraphAfter
'.MoveEnd wdCharacter, 1
'.Collapse wdCollapseEnd
End With
End If
Next nIndex
End Sub Tag: why my microsoft word is lock Tag: 113648
How to run a macro multiple times by one click
Hi there,
I made a macro to convert a text file into a RTF file with a desired format.
But it stops after it converts and saves a current file. In other words, one
click of macro runs for each opened file. It must have some ways to do one
click for multiple opened files conversion. Any suggestions or recommeded
articles or codes?
Thanks, Tag: why my microsoft word is lock Tag: 113644
Multi page numbering
In my document header I have the standard page numbering, â??Page {Page \*
MERGEFORM at } of {NUMPAGES \* MERGEFORM AT }â?? which displays â??Page 1 of
100â?? as an example. In my attachments at the end of the document in the
footer I would like to number them separately. An example would be if the
first attachment has 4 pages, the header shows â??Page 90 of 100â?? and the
footer would show â??Page 1 of 4â?? on page one, â??Page 2 of 4â?? on page 2 and so.
Then in the second attachment the footer numbering would start over. The
total number of pages in the section is the easy part. I can just use â??{
SectionPages }â??. How would I get the individual pages in the section to show
the correct numbering (1, 2, 3, 4)? I looked at Greg Maxeyâ??s Page_Numbering.
This would only work as you create a new document. As I would create a new
section, I would have to add a bookmark and then go up into the header and
add a new PageRef. If Iâ??m converting documents and donâ??t know how many
sections there are, this wont work. This would take forever to go through
each document manually and do. Is this the only option there is? If it is, is
there a way to write a macro to go through the document and create the
numbering? This seams to me to be a huge short coming of Word. Tag: why my microsoft word is lock Tag: 113643
Window Switching
I did this a while ago in Word 2003 and left the code at my previous job. I put it back together based on what y'all had posted. It isn't a toggle but a cycler.
Sub WindowSwitch()
' WindowSwitch Macro
If Windows.Count > 1 And ActiveWindow.Index < Windows.Count Then
ActiveWindow.Next.Activate
Else
Windows(1).Activate
End If
End Sub
I assign this to ctrl` so that it is similar to switching windows/tabs in many other programs. Unfortunately you can't use ctrl-tab. Tag: why my microsoft word is lock Tag: 113642
Create your own templates?
Hi!
Do you have any advice on where to find information on how to
create your own templates.
Thanks. Tag: why my microsoft word is lock Tag: 113640
Find Replace for Word in Header, Footer, Body (VB.NET)
I need to be able to select the area when doing a find and replace using the
Word Interop library. I have the find and replace working, but I need to
know how to search the different areas: header, footer, body.
--
J. Clark
http://www.viesoft.net Tag: why my microsoft word is lock Tag: 113629
ConvertToTable troubles with date fields formatted with "-"
Hello,
I'm using VBA-code from Access to build and fill a word table.
I've got a ADO-Recordset with data like these:
ADE 10-08-2007 11-08-2007
TRW 04-22-2008 04-23-2008
code-snippet:
Public Function fctCreateTableFromRecordsetMON(rngAny As Word.Range _
, rstAny As ADODB.Recordset _
, Optional fIncludeFieldNames
As Boolean = False _
) As Word.Table
Dim objTable As Word.Table
Dim fldAny As ADODB.Field
Dim varData As Variant
Dim strBookmark As String
Dim cField As Long
' Get the data from the recordset
varData = rstAny.GetString()
' Create the word-table
'---+++---+++---+++---+++
With rngAny
.InsertAfter varData
Set objTable = .ConvertToTable()
.
.
.
End With
'---+++---+++---+++---+++
Set fctCreateTableFromRecordsetMON = objTable
End Function
The problem is, the two dates in every Recordset row have a minus-sign
as separator and this seems to trouble the word table since word
appends two columns to the word-table and writes some stuff of the
dates into.
So the ConvertToTable-command doesn't work right for these date
fields. How can I simply insert date fields formatted with "-"?
thanks
candide_sh Tag: why my microsoft word is lock Tag: 113628
InsertObject Macro blocking access to other Insert Menu Items
I created the simple macro below for a protected form template that is
executing in a non-protected section of the form template. The bounding box
dimensions have been entered into the macro so the user has a good size
working area to begin.
The macro is stored on a toolbar with other customizations.
When the user wants to use INSERT with some some function, other than
"Microsoft Word Picture", like Equation Editor, the macro executes and high
jacks them into the Word Picture Editor. Is this normal? They are not
clicking on the button to execute the macro in the toolbar.... is there a way
to modify the code in the macro to get the user to the dropdown list so they
can scroll down and make their selection?
See code below..... Lenny
Sub InsertObject()
'
' InsertObject Macro
' Macro recorded 5/14/2008
'
Selection.InlineShapes.AddOLEObject ClassType:="Word.Picture.8",
FileName _
:="", LinkToFile:=False, DisplayAsIcon:=False
Selection.PageSetup.LeftMargin = 84
Selection.PageSetup.RightMargin = 462
Selection.PageSetup.BottomMargin = 330
End Sub Tag: why my microsoft word is lock Tag: 113623
TOC QUESTION
I am trying to remove the underline words in my TOC. I have the following
macro, but it removes all the underlined words in the hole document. What am
I doing wrong?
With ActiveDocument.TablesOfContents
Selection.Find.ClearFormatting
With Selection.Find
.Font.Underline = wdUnderlineSingle
.Replacement.Font.Underline = wdUnderlineNone
.Execute Replace:=wdReplaceAll
End With
End With Tag: why my microsoft word is lock Tag: 113619
Modal vs Modless Forms
I can find lots of info on Modal vs Modeless forms in Word, but none answers
my question.
My biggest reason for wanting to use a modeless form is so that the user can
click out of the form and scroll around their document without closing the
form.
The problem is that once a form is set to modeless, the macro no longer
waits for the form to be dismissed before continuing. The macro just
continues to run.
Without restructuring my whole macro, how can I get a macro to call a form
and wait until it is dismissed, but still retain the ability to click and
scroll outside the form? Tag: why my microsoft word is lock Tag: 113617
Recently introduced bug in Word (2002)?
Here's an oddity... very annoying as it has screwed up some custom
commenting functionality and I can't find a fix or workaround...
[Applies to Word 2002, all updates except the OWC vulnerability patch
applied; Vista HP SP1 + updates; Intel Core Duo laptop, 2GB RAM]
Since probably some time in Feb 2008, Word 2002 seems to unpredictably
change the case of the username text when creating the Author (VBA)/
Reviewer Name (UI) for comments...
It's not uniformly UPPER case, lower case or Title case and, worst of all
which, username strings will be transformed and how is not stable.
Can anyone else reproduce it? Is there any fix?
I know Word 2002 is out of "mainstream support" but if this is a bug
introduced by some recently security patch I hope MS will undo the damage...
Further info...
It only seems to affect short usernames ~<=4 characters, although I had one
longer example ("CuZs" which became "cUzS" - but this did not re-occur after
a system restart - manually set that rather than rely on the random number
generator to reproduce it) It could be the probability of error just
decreases with string length (in a run in which string length was 4-10 -
each 100 times - no errors were enountered) but that's no gurantee...
Here's some banged together code that randomly changes the username, creates
comments, checks the Author string against the username and leaves only
those that don't match... [what's the pattern (if any)?]
Same results run to run, same results if word is shutdown and restarted;
*different* results after system restart!
Sub usernameTesting()
Dim aStr As String
Dim aChar As String
Dim i As Long
Dim j As Long
Dim k As Long
Dim aRange As Range
Dim oldUser As String
Dim aCom As Comment
Documents("username test.doc").Activate
oldUser = Application.UserName
Application.ScreenUpdating = False
i = Int(Rnd(-1)) ' force sequence to repeat so runs can be compared
For i = 1 To 100
For j = 1 To 8
aStr = ""
For k = 1 To j
aStr = aStr & randChar
Next
Selection.InsertAfter aStr & vbCr
Set aRange = ActiveDocument.Words(ActiveDocument.Words.Count -
2)
Application.UserName = aStr
Set aCom = ActiveDocument.Comments.Add(aRange, aStr)
If aCom.Author <> aStr Then
Debug.Print i, aStr, "->", aCom.Author
Else
aRange.MoveEnd unit:=wdCharacter, Count:=1
aRange.Delete
End If
Next
Next
Application.UserName = oldUser
Application.ScreenUpdating = True
End Sub
Function randChar() As String
Dim j As Long
randChar = Chr(Int((Asc("Z") - Asc("A") + 1) * Rnd + Asc("A")))
j = Int(Rnd * 10)
If j Mod 2 = 0 Then
randChar = LCase(randChar)
End If
End Function
Sub testRandCharReproducibility()
Dim i As Long
i = Int(Rnd(-1)) ' force sequence to repeat so runs can be compared
For i = 1 To 10
Debug.Print randChar
Next
End Sub
--
Julian I-Do-Stuff
Some Vista stuff, but mostly just Stuff at http://berossus,blogspot.com Tag: why my microsoft word is lock Tag: 113608
sort appending order of documents
hello everyone
I'm using the following code to append some files.
the problem is it is appending first the last one I select.
I need to reverse this order.
I want the first file selected to be at the top of the final document. And
the second one second and so on.
Sub joinSelectedFiles()
Dim fd As FileDialog
Application.ScreenUpdating = False
Documents.Add
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
With fd
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
Selection.InsertFile FileName:=(vrtSelectedItem), _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdSectionBreakNextPage
Next vrtSelectedItem
Else
End If
End With
Set fd = Nothing
End Sub
any help would be appreciated
thanks
ahmed Tag: why my microsoft word is lock Tag: 113606
KB950241 Issues Outlook with word
After taking latest updates including KB950241 a clients outlook 2003
can no longer reply/forward or open word attachments. outlook hangs.
after removing KB950241
outlook behaves like it used should. Tag: why my microsoft word is lock Tag: 113603
problem with inserting/deleting file w/ section break and page bre
I have a template that has the ability to add/delete files. Works great.
Latest request is to insert another file, however with this file, because of
size I cannot do a section break, only page break as the footer and header
would not allow for enough room. Adding this file(FileA) is fine. When I add
another (FileB)with a section break, the bottom of it gets a 16 pt. font, too
large to remain on 1 page.
The top of file A has 16 pt, bottom of file A has 8pt. File B has 11 pt.
What is the probelm?
2)I have a delete macro which deletes the files, up to 4 currently but, with
this new file it bombs.
I'm assuming because it was not addede with a section. I count how many
files added and then delete that many.
Curernt code to delete:
>Dim rnge As Range
> Set rnge = ActiveDocument.Sections.Last.Range
> rnge.start = rnge.start - 1
> rnge.Delete
How do I delete fileA?
Hopefully this is enough info to give you an idea.
Thanks,
Bryan Tag: why my microsoft word is lock Tag: 113600
Copying Text to Bookmark Names
In Word 2000, I have a document that lists a series of ID numbers, titles,
and other information, each in a five-paragraph set. Each paragraph within
each set has a unique paragraph style. I would like to develop a macro that
does the following for each set:
1. Use the text of the ID paragraph (style: "Web ID") as a bookmark name for
the title paragraph (style "Title").
2. Remove the ID paragraph.
3. Repeat for the entire document.
Thanks!
Jerry Tag: why my microsoft word is lock Tag: 113595
Sherching for a color and inserting text.
I have a rather large word document that has several words colored in Red and
Green.
I would like to insert a word a the beginning of every paragraph that
contains a red or a green word.
For example the word "[RED]" at the beginning of every paragraph containing
a word colored in red text and the word "[Green]" in front of every paragraph
that containing a word colored in green text.
I hope the above makes sense, any help is much appreciated
Thanks in advance Tag: why my microsoft word is lock Tag: 113588
Macros disappear
Hi,
I have recorded a Macro in Word 2003 with a keyboard shortcut CTRL+Shift+N,
which works perfectly on my system.
I have two questions:
1. I cannot view my own macros on my system when I reopen the document, but
the macro works.
2. When I send the same document to another person, the macro does not work,
neither it shows the macro when I press Alt+F8.
I have checked the Macros security level on both the PC's and it says
"Medium" which is fine.
Kindly help,
Prashanth KR. Tag: why my microsoft word is lock Tag: 113585
RD field disapears at the stroke of D key
It was suggested to me yesterday that I use macros to go through and make up
this table of contents from multiple sources. I started the first couple of
steps and to add in each individual document to the table, I started using RD
fields.
The only problem is once I get to here { R }, as soon as I type D the entire
RD field disapears. I've tried Ctrl + Shft + 8 to try and see if there was
something typed in that shouldn't be, but all that comes up is the normal
everyday paragraph and space indicators .
I've even tried to copy and paste the RD field in from another programme,
but the same thing happens. Tag: why my microsoft word is lock Tag: 113574
upgraded vba dll to vb.net dll not working with createobject
Hi ,
I am working on a project to upgrade vb6 dlls, which we use in our vba
project, to vb.net
So I made a sample vb6 activex dll, which has a function that
displays a message box.
Then I upgraded this dll to vb.net and did all the stuff that one
usually does to make a .net assembly visible to COM / vb6.
1) Made the .net dll com visible.
2) registered for COM interop
3) Signed with a strong name and built the project.
Now I tried to display the message box, using VBA.
dim abc as project1.class1
set abc = new project1.class1
abc.display
------it displayed the message box present in the dll.
But when i tried with createobject, an error message comes saying '
ActiveX component cannot create the object'
dim myobj as object
set myobj = createobject("project1.class1")
myobj.display
I tried my best and searched the net for some help but couldnt get
anything.
So could you tell me why this works with early binding(new) and not
with late binding(createobject).
I really need to use createobject in my project.
Any ideas??
Please help. Tag: why my microsoft word is lock Tag: 113571
Save WORD DOC in TIFF format using VB6 Script to
Hi Guru,
I am trying to save WORD 2003 document in TIFF format using Vb6 script. How
to do it?
Here is my Vb script
Reference Lib:Microsoft Office Document Imaging 11.0 library
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTiffDoc As MODI.Document
Dim newTiff As String
Set oWord = New Word.Application
Set oDoc = oWord.Documents.Open("H:\Junk\TestTiff.doc", ,
ReadOnly:=True)
Set oTiffDoc = New MODI.Document
newTiff = " E:\Westpac\TestWORD2TIFF\Myfile.tif"
oTiffDoc.SaveAs oTiffDoc, miFILE_FORMAT_TIFF
Please Help me. Thanks.
Cheers,
Lennie Tag: why my microsoft word is lock Tag: 113560
Tell if a comment is tracked as deleted
Can VBA decide whether an embedded comment is within an area marked by
tracked changes as deleted text?
I'd hoped there'd be some range-like property representing the tag
itself (the space occupied by the initials-and-number). Doesn't look
like it though. Eh?
Word 2003 SP3.
MT Tag: why my microsoft word is lock Tag: 113558
assigning macro/code to picture?
in Excel 2007, you can assign a macro or code item to a picture.
can the similar be done in Word 2007, or can codes only be assigned to a
command button object?
thank you,
jat Tag: why my microsoft word is lock Tag: 113554
opening this document will run the following sql command
Office 2003:
Today, for the first time, I've started getting the following annoying
message box every time I open a Word document, or even when I create a new
document from scratch:
opening this document will run the following sql command
Data from your database will be placed in the document. Do you want to
continue?
The line below this line in the dialog box is blank and if I close the
document, I am not prompted to save anything.
Running Detect and Repair does not correct the problem.
Reverting to older versions of Normal.dot does not correct the problem.
This computer is not networked, Office 2003 was installed from original CDs
and I am the only user of this computer.
I use Word almost every day, and each day's work is backed up to an
external drive.
Researching the text of the message led me to this:
http://support.microsoft.com/kb/825765
but I am reluctant to try it because of the warning attached to the
information. It also says that this message is encountered when I open a
mail merge document that is linked to a data source.
I have never used mail merge since installing Office 2003. I know nothing
about VBA and do not use programming code other than simple, basic Word
macros which I have written myself.
My AVG Professional 8.0 antivirus is kept up-to-date. I routinely apply all
Windows patches through Windows Update.
The only unusual event that I have noticed here was that last night when I
shut down the computer, Windows prompted me that there were updates ready
to apply and offered me the option of applying them before shutting down
the computer. As yesterday was Patch Tuesday, I assumed that Windows had
downloaded these updates automatically as the system is configured to do.
Usually I go to Windows Update myself and manually download and install
updates, but I was busy with a number of things yesterday and so did not
visit Windows Update. I allowed Windows to install the updates before
shutting down because I assumed that these updates had been downloaded by
Windows in the absence of any action by me.
Further research has led me to the discovery that one of the patches
applied was to Word 2003 (KB950241). I removed this update and the problem
went away.
I spent an hour on the phone with a Microsoft technician only to eventually
be told that a technician from the "Word department" would have to call me
back. As the security update is flagged as critical, I cannot block its
download and installation.
For the time being, my only recourse is to use the registry hack provided
in http://support.microsoft.com/kb/825765, but for obvious reasons I'm not
comfortable with this arrangement.
I would really appreciate help from any Word MVP out there who can draw a
bead on this issue.
Tom
--
remove .spoo to reply by email Tag: why my microsoft word is lock Tag: 113546
Creating a master document made up of several linked source docume
My company has me taking apart some of our current manuals and setting them
up so that each individual section of the manuals could be accessed from one
of our offices remotely and the changes that they make update their in the
master copy that goes out to each of the workers on site.
The sending of the master and compiling of the sections individually is no
problem, however whenever I got to link the files into the master copy I
usually would just select Insert>Objects>Create From File>browse>insert the
file and select for the file to be linked to the source and for it not to be
displayed as an icon.
I'm getting to larger word documents and I found that anything that is
longer than 1 page in length in the original source document is only being
displayed as one page of content in the master. It seems to just cut off at
the bottom of the page that I'm trying to link it into.
Any suggestions? Tag: why my microsoft word is lock Tag: 113540
IntelliSense & Passing Range and/or Document Objects
I realize that my questions here might be simply a matter of taste and
programming style, but Iâ??m also wanting to run this pass those on this forum
to make sure Iâ??m not getting myself into trouble by making unwarranted
assumptions.
Iâ??ve been using the following to open a new document and to set a range
object.
Dim oDoc as Document
Dim oRange as Range
Set oDoc = Documents.Add(sTemplate)
Set oRange = Selection.Range
But, if Iâ??m not mistaken, this is the same as:
Set oDoc = Documents.Add(sTemplate)
Set oRange = oDoc.Range
Yes? Is there a difference between them? (And doesnâ??t the latter make more
sense? At least it took me some time to figure out that by creating a new
document, the new document as now the active document, and so here
â??Selectionâ?? = â??oDoc,â?? yes?)
Also, Iâ??ve been passing both the document object and range object to
functions, would it be simpler to pass only the range object and when/if I
need the document object to recreate it such as:
Function Xyz(ByVal oRange as Range, ... etc.)
Dim oDoc as Document
Set oDoc = oRange.Parent
It also seems to me that:
Dim oStyle as Style
Set oStyle = oDoc.Styles("Some Styleâ??)
is the same thing as:
Set oStyle = oRange.Parent.Styles("Some Sytle")
Both statements appear to work equally well, the only difference appears to
be that the IntelliSense doesnâ??t work with â??oRange.Parent,â?? but the code ran
fine.
It also seems to me that one could even dispense with creating a styles
object and write:
Dim ptFontSize as Single
ptFontSize = oRange.Parent.Styles(â??Some Styleâ??).Font.Size
I apologize if all this seem trivial, but it has taken me hours to figure
all this out. My question is this: Instead of passing both a document object
and its range object to another function, wouldnâ??t it simplify things to pass
only one, and then use that object to create the other if needed? The reason
I ask is that my current project works with three documents, and passing
three ranges, plus one or two document objects, as well as other variables.
It creates a long and cumbersome augment/parameter list. Or am I better off
with a long augment/parameter list?
I would greatly appreciate any feedback on the above.
Steven Craig Miller Tag: why my microsoft word is lock Tag: 113537
Text box formatting moves text box
In normal Word usage I can change the text margins and size of a text box
using the Format Text Box dialogue and the text box stays in the same
position. However, when I try to do the same operations while recording a
macro the text box gets moved to the top left corner of the page when I click
on OK. How can I stop this happening, or at least edit the macro so the
position of the text box is not altered?
Grateful for assistance. Tag: why my microsoft word is lock Tag: 113535
Word 2007 and my macros?
We just got the word - we will be "upgrading" to Office 2007 shortly.
I _live_ by my macros! If they worked fine in Word 2000 and 2003,
will they still work in 2007?
I figure I need to make a backup of my Normal and templates. I know
the toolbars won't show up in 2007, and any macros that show or hide
toolbars on open or close won't work. If I clean these macros out of
my files, should everything else be mostly okay?
Ed Tag: why my microsoft word is lock Tag: 113531
How to change sign of paragraph on the space?
There is a document Word (see example: http://www.box.net/shared/luo0o336so).
Some sentenses in paragraphs are broken off by paragraph signs, other
paragraphs is ok.
The problem - I need to join the broken of lines of each paragraph,
but thus not uniting normal paragraphs.
The end of the normal paragraph consists of a point and a paragraph
sign.
The end of a line of the broken off paragraph consists of a paragraph
sign.
Here the code which I try to use, but has stopped on replacement
operation. Correct me please and explain what is my wrong. Thanks.
Code:
Sub delpar_3()
Dim sPar As String
Dim par As Paragraph
Dim i As Integer
i = 0
For Each par In ActiveDocument.Paragraphs
If Right(par, 2) = Chr(46) & Chr(13) Then
i = i + 1
Else
If Right(par, 1) = Chr(13) Then
par = Replace(par, Chr(13), " ") 'Here is error!!!
End If
Next par
End Sub Tag: why my microsoft word is lock Tag: 113529
Date Function manipulate result
Help to manipulate/assign result CalculateAge to my ActiveDocument screen,
assign it toa DocProp or DocVariable
and a ContentControl
or the ActiveDocument screen at a bookmark please?
I can read result CalculateAge in a MsgBox fine.
Function Calculate(birthDate As Date) As Byte
Dim birthdayNotPassed As Boolean
birthdayNotPassed = CDate(Month(birthDate) & " / " & _
Day(birthDate) & " / " & _
Year(Now)) > Now
CalculateAge = Year(Now) - Year(birthDate) + birthdayNotPassed
End Function Tag: why my microsoft word is lock Tag: 113528
SEQ numbering within IF fields in Word 2003
Hi,
I have a template I am developing which uses the SEQ field to auto number
the paragraphs. However, a number of these paragraphs are within IF fields,
so that if certain conditions are met/not met then they do not get output
into the document when ran.
Unfortunately, the SEQ number (which is also in the IF) is still getting
set. So for example;
IF is true =
1. paragraph one
2. paragraph two
3. paragraph three
4. paragraph four
IF is false =
1. paragraph one
4. paragraph four
What I need to see is (IF false) =
1. paragraph one
2. paragraph four
How can I prevent the SEQ from being set if the IF is false?
Thanks Tag: why my microsoft word is lock Tag: 113520
Issue with Office 2007 Macro security
I have some word templates which were originally made from earlier versions
of word. They all open fine till Word 2003. But in Word 2007 the macros do
not show up in the macros list. I also cant debug the macros through VB
Editor.
I have added the location of the templates in Trust Center Locations and
also enabled all the macros in the Macro Settings, but still these are
blocked. Can anybody help me out with this please. Tag: why my microsoft word is lock Tag: 113518
Access to Adobe PDF menu?
I use the AutoOpen macro to pop up a user prompt. I need this prompt here to
set correct font sizes depending on language. Apparently, when I Convert to
PDF from the Adobe PDF menu, the AutoOpen macro is run. I am trying to figure
out a way to determine if AutoOpen was called from Adobe's PDF creation
process, and if so, bypass my user prompt. Any ideas? Thanks! Tag: why my microsoft word is lock Tag: 113509
UserForm question
I have created several bookmarks in my document. I then created a UserForm
(UserForm1) and added code to the command button on the form such as:
Private Sub CommandButton1_Click()
With ActiveDocument
.Bookmarks ("RecipientName").Range_
.InsertBefore TextBox1
.Bookmarks("RecipientReturnAddress").Range_
.InsertBefore TextBox2
.Bookmarks("RecipientCSZ").Range_
.InsertBefore TextBox3
.Bookmarks("ReferenceNo").Range_
.InsertBefore TextBox4
.Bookmarks("Salutation").Range_
.InsertBefore TextBox5
.Bookmarks("Scope").Range_
.InsertBefore TextBox6
.Bookmarks("PrimaryAttorney").Range_
.InsertBefore TextBox7
.Bookmarks("PrimaryAttorneyRate").Range_
.InsertBefore TextBox8
.Bookmarks("SecondaryAttorney").Range_
.InsertBefore TextBox9
.Bookmarks("SecondaryAttorneyRate").Range_
.InsertBefore TextBox10
.Bookmarks("MoniesRecoveredBy").Range_
.InsertBefore TextBox11
.Bookmarks("AmountsRecoveredFrom").Range_
.InsertBefore TextBox12
.Bookmarks("Retainer").Range_
.InsertBefore TextBox13
.Bookmarks("SigningAttorney").Range_
.InsertBefore TextBox14
.Bookmarks("DayofMonth").Range_
.InsertBefore TextBox15
.Bookmarks("Month").Range_
.InsertBefore TextBox16
.Bookmarks("TwoDigitsYear").Range_
.InsertBefore TextBox17
End With
UserForm1.Hide
End Sub
Bookmark names are enclosed in " " after .Bookmarks
and text box names are referenced after .InsertBefore
I created a macro that will show the userform.
WHen the userform is filled in and the command button is clicked, I get an
error message:
Compile error:
Method or data member not found
The vba window opens and .Range_ is highlighted
Any ideas what is going wrong?
Also, the macro that shows the userform - what do I need to call it to get
it to run automatically when the document is opened?
The file is saved as a .doc (Word 2003 Pro) - can't do a .dot in this
particular situation so it needs to be a doc, not a template.
THanks so much, in advance, for any assistance. Tag: why my microsoft word is lock Tag: 113504
Extract character styles into new document
Hi all,
I'm trying to extract text with particular character styles into a new
document. I've tried the following code, and it just runs an endless
loop:
Sub CollectCustomTopics()
' highlight parts of speech in a particular color then count the
number of lines in the new document!
Dim NewDoc As Document, MainDoc As Document, r As Range
If Documents.count = 0 Then Exit Sub
Set MainDoc = ActiveDocument
Set NewDoc = Documents.Add
MainDoc.Activate
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Highlight = True
Do While .Execute
DoEvents
Set r = NewDoc.Range
r.Collapse wdCollapseEnd
Select Case Selection.Style
Case "Topic Level 1"
r.InsertAfter "Topic Level 1"
'r.ParagraphFormat.LeftIndent = 18
Case "Topic Level 2"
r.InsertAfter "Topic Level 2"
Case "Topic Level 3"
r.InsertAfter "Topic Level 3"
Case "Topic Level 4"
r.InsertAfter "Topic Level 4"
Case "Topic Level 5"
r.InsertAfter "Topic Level 5"
Case "Topic Level 6"
r.InsertAfter "Topic Level 6"
End Select
r.InsertAfter Selection.Range.FormattedText
If Selection.Characters.Last.Text <> vbCr Then _
r.InsertAfter vbCr
Loop
End With
NewDoc.Activate
End Sub Tag: why my microsoft word is lock Tag: 113503
Invoke, and pass argument to, File Save As dialog, with a macro?
For a specific template only, can a macro trigger a file/save as AND place a
suggested file naming convention prompt in the Filename window of the File
'Save As' dialog?
ie,
User clicks a macrobutton;
Word's Save As dialog opens;
In the File Name window, a suggested file name schema appears, ie.,
"please type the date (yymmdd), check number, and brief description of item" Tag: why my microsoft word is lock Tag: 113497
Resize ActiveX Checkbox/Radiobutton
Ok i'm hoping this is simple because I just can't figure it out. Is there
anyway to increase the size of the ActiveX controls in Word 2003 like how you
can with the From buttons? Tag: why my microsoft word is lock Tag: 113496
AutoOpen macro doesn't run
this macro issupposed to automatically display the AutoText menu when a
document is created from a template:
Sub AutoOpen()
CommandBars("AutoText").Visible = True
End Sub
When I create a new document from the template, and tell Word to enable
macros, a new document opens but the autotext menu does not display. Why? Tag: why my microsoft word is lock Tag: 113488
custom ui editor getting rid of code
I don't know if it something I am doing or not - but it is driving me crazy.
I am using the Custom UI Editor to customize the ribbon in Word 2007. I
create my ribbon and saved to my template. I then opened the template and
added the RibbonControl vba code and a module containg some code for showing
message boxes, etc. Saved the template. All code is present.
Then I went back into the Custom UI Editor to make changes, saved it to the
template, but when I opened the template in Word, all my previous modules and
code are gone.
What am I doing wrong? Help! Tag: why my microsoft word is lock Tag: 113477
Macro execution by Autotext entry
Hello,
Is there any way to get an autotext entry to execute a macro? In other
words, I'd like to create an autotext entry that when the user gets the
pop-up to press enter, that when they do, it executes a macro. I'm pretty
sure there is no way to do this but I just thought I'd ask to be sure. I'm
using Office 2003 but 2007 available.
Thanks,
Peter Tag: why my microsoft word is lock Tag: 113473