Searching for text in all the documents in a folder and its subfolders
I have a couple of macros that can run a macro in all the documents in a
folder. But I want to do something that those macros can't handle. I
want to do a Find (not a replace, just a find) that will stop at each
occurrence of the found text in all the documents in a folder (and
optionally its subfolders). This is difficult because the code in the
below macro to close the current document and move on to the next
document must not run until all the searched-for strings in the first
document are found. In the below code, I've commented out the Close
Document code.
Normally, if I do a Windows Find for the documents that contain the
text, I still have to open each document individually and search again
for the text. I want to make it all one continuous search, opening a
document, stopping at each instance of the found text as I repeat the
command, and then when there are no more to be found in that document,
closing it and opening the next document. Can that be done?
Thanks,
Larry
Dim sFileName As String
Dim sFolder As String
'Replace with your own foldername
sFolder = "C:\Documents\Tests\"
sFileName = Dir(sFolder & "*.doc")
While sFileName <> ""
Documents.Open (sFolder & sFileName)
'run macro
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "powerful"
.Forward = True
.Wrap = wdFindContinue
.MatchCase = False
End With
Selection.Find.Execute
' commented this line out.
' ActiveDocument.Close savechanges:=wdSaveChanges
sFileName = Dir()
Wend Tag: String variabla to Integer of Long Tag: 46403
Price calculations in Word
I need to calculate prices in a table in word, and my VBA
needs to be able to start at the first row, look at aCell
and multiply it by bCell and place the value of that in
cCell. My problem is that I don't know how to reference
each cell location. I have done quite a bit of work with
excel/vba but nothing with word. Tag: String variabla to Integer of Long Tag: 46396
Sending function to VBA from VB6
Hi there
I want to create a function in VB6 that can be copied from a VB6 application to the VBA area in a Word 2002 file so that it works as if I had created the macro in Word itself. The functionality provided will create a menu item that can perform specific duties. Any one know how to do this? I have read somewhere about VBE, VBProjects but there is not enough detail
Thanks in advance Tag: String variabla to Integer of Long Tag: 46394
"property not available" error in macro
Hey there,
I wrote a macro to prompt for the location of a few pictures using
wdDialogFileOpen and insert them into a Word document. It works
great, but now the user is opening this document in an application
that imbeds Word as an OLE object. Now I get run-time error '4605':
This method or property is not available because this document is in
another application."
The code snippet is below; it gives me the error on the first (With
Dialogs) line:
With Dialogs(wdDialogFileOpen)
.Name = "*.jpg; *.gif; *.bmp"
If .Display Then
strFileName = CStr(Trim(WordBasic.FilenameInfo(.Name,
1) & ""))
Else
strFileName = ""
End If
End With
Any suggesstions on how to return control or focus to the document so
I can instantiate the "open dialog" window?
Thanks, C
kaczmar2@msu.edu Tag: String variabla to Integer of Long Tag: 46393
Mouse Pointers
One of the properties options for a command button is a great big list of
different types of mouse pointers that will display when the cursor is run over
the button. As luck would have it, the one that I want (the "hand" -- or maybe
better, the "finger" -- pointer finger, that is) isn't in the list. As
ubiquitous as the finger is in daily operation, I am curious (1) why it's not
one of the choices and (2) can I still call it via "Custom Pointer (#99).
Thanks, Tag: String variabla to Integer of Long Tag: 46392
Word App which is compatible with both Word 2003 and Xp
Hello:
I am working in VB.Net 2003. My company is in the process of making a program which will interact with the users version of Word on their machine (basically open a document, replace some characters, etc...). Currently I have made my solution work with Word 2003. I am now trying to make it work with Word XP. I guess the first question I 'd like to ask is if it is even possible to make one solution which will use the correct Dll's which coincide with their version of word?
I have totally redone the app and used only the XP dll's (office.dll and word.dll) and it works. But i really dont want to have 2 versions of my code due to the fact that it will be much more difficult to maintain.
I do have the office tools for visual studio 2003.
If anyone has some answers, suggestions or even examples, they will be greatly appreciated.
Thanks for your time.
Brian Tag: String variabla to Integer of Long Tag: 46390
Find Styles in Footer
What is the best way to find a style in use within all
footers of a document, AND TO BE NOTIFIED?
In other words, cycle through all pages of a document and
look in the footer to see if a particular style exists. If
it does, then msgbox me.
Thanks,
Doug Tag: String variabla to Integer of Long Tag: 46388
How to make a variable persistent?
Hi,
Does anyone know how to make a variable persistent over a long time?
I have a macro that manipulates words that are selected in a document.
Therefore I retrieve (from the registry or an ini file) the name of a
database file and store this name into a variable.
I prefer to do this only once, when the macro is initiated/started for
the first time, rather that retrieving the database name each time a
word is manipulated.
Any idea how I could achieve this? How I can keep my macro "alive" while
no words are selected or manipulated?
The macro's are written only in "Sub" procedures, there are no functions
and no forms.
Kind regards,
ANDy Tag: String variabla to Integer of Long Tag: 46382
Runtime Error 4605
I use Office 2003 on XP Pro.
I did a mail merge to construct a file from which to print labels for about
200 addresses from my OL Contacts. I then recorded a macro as I went
through the same steps. When I ran the macro, I got runtime error message
#4605. "This method or property is not available because the current mail
merge main document needs a document source."
How do I correct this condition, so the macro will run?
Thanks for the help. Tag: String variabla to Integer of Long Tag: 46379
Find Char and Replace with a Symbol
Also posted in "General Questions"
Greetings !
I have this, generated by recording a Macro :
Selection.Find.Replacement.Font.Name =3D "MS LineDraw"
With Selection.Find
.Text =3D "=B3"
.Replacement.Text =3D "=B3"
.Forward =3D True
.Wrap =3D wdFindAsk
.Format =3D True
.MatchCase =3D False
.MatchWholeWord =3D False
.MatchWildcards =3D False
.MatchSoundsLike =3D False
.MatchAllWordForms =3D False
End With
Selection.Find.Execute Replace:=3DwdReplaceAll
but now that MS LineDraw won't work, I thought I could=20
substitute this, wot I got also by recording a Macro:
Selection.InsertSymbol _
Font:=3D"Courier New", _
CharacterNumber:=3D9508, _
Unicode:=3DTrue
but I can't seem to marry this snatch with the previous=20
code, to do the lot.
Help !
RClay AT haswell DOT com Tag: String variabla to Integer of Long Tag: 46377
Breaking Links in Word using VBA
I am trying to find away to automatically break linked
data from excel with out having to use the "edit" menu,
and after much searching have drawn a blank.
If anyone has any ideas if it's possible, i'd be very
appreciative Tag: String variabla to Integer of Long Tag: 46375
Save to Network
Hey Gang,
I am assisting individuals with developing their resumes
using Word Resume Templates. There could be up to 20
students with a wide range of computer experience. The
students are given a disk to save & keep a copy of their
completed resume. I also need a copy of their resume.
I need a macro that will:
1. Use the file name already assigned to the document.
(It will be a unique name).
2. Save the file to a network location: P/cisco/resume
3. Again save the document 'A' drive
4. End the macro.
Your help appreciated - Thanks,
Jerry Tag: String variabla to Integer of Long Tag: 46370
Macros running much slower than before
I have a very large and complex library of macros which I developed largely
under Word 2000 and Windows 2000 on a computer with a 733MHz Pentium 3. I'm
now running them under Word 2002 and Windows XP on a laptop computer with a
2.2 GHz Pentium 4. I find that certain operations run much slower on the new
machine. "Much slower" means that a macro which used to display its first
dialog box in a second or less now typically takes 20 or 30 seconds to
display it.
Much of the slowness (but not all of it) seems to be associated with some
type of initialization. That is, the second time I run a macro it starts
much more quickly than the first time, although still not as quickly as it
did on the old machine.
The machines have the same amount of RAM (512MB). I can't identify any
differences that might account for this problem except that since the new
machine is portable, it has a slower disk, and its CPU might have a smaller
cache. I have a hard time believing that either of these factors accounts
for the drop in performance. I have watched the laptop computer's disk
activity light while these macros are starting, and it seems to be no more
busy than when the computer is idle.
What might be the problem here? How can I identify it?
. Tag: String variabla to Integer of Long Tag: 46369
Msworld9.old ok but not Mso9.dll
Hello everybody, (particular Tom)
For Tom :
I have tested the problem with an unprotected version of the document (I
have sent it to my customer), and it's effectively a compilation error
because of Mso9.dll missed.
For Everybody, I explain the problem :
I write macros VBA on Word 2000 and in a PC full XP (Office XP Pro, Win
XP...) in one of my customer, it doesn't works because of dll missed whitch
is finaly Mso9.dll. If I check the VBA references in this document in my
configuration (Office 2000, W98) I see 4 dll referenced : VBA, OLE
Automation, Mso9.dll and msword9.olb. Those references are the default
references...
In one of my customers whitch has Office XP, Mso9.dll and msword9.olb
don't exist => Compilation error... because Mso9.dll is missed (only it).
The code is protected so he can't change the references.
What can I do to pass this problem and to make macros whitch works on the 2
systems ?
A solution would be to make 2 files : 1 for Word 2000 and 1 for Word XP but
it's not good to maintain
So, Is there a service pack whitch fix this problem or a method to "prepar"
the VBA environment ?
Thanks for your answer.
Francois
Ps : sorry for the mistakes :-) Tag: String variabla to Integer of Long Tag: 46365
how to store a picture of msword into a visual basic picture box control using a visual basic for applications
i have a picture in ms-word and i want to store the picture in visual basic object using visual basic for applications
through that object i want to show in a picture box control in visual basic 6.0
and
is there a method which will take a picture and store it in a jpeg or bmp file format in memory Tag: String variabla to Integer of Long Tag: 46357
Listview
Hi all,
Can anyone help?
I need to set the properties of a listview control so that
one column shows item numbers (1, 2, 3, ect)up to a pre-
stated number of items. with a corressponding column
allowing the user to enter a description of the item next
to the relevant item number.
The whole lot is then to be printed on a word doc.
I have not encountered this control before. Can anyone
assist?
Kind regards
Adrian Tag: String variabla to Integer of Long Tag: 46350
How to pass a Two Date parameter to a report at runtime using VB .NET
hi,
How to pass a Two Date parameter to a report at runtime using VB .NET
1. How do we pass multiple values eg. Startdate, EndDate to crystal
reports
parameter.
2. I have a report to filter by two dates like FromDate And ToDate
my Code is following which i have written.
It shows Error like " Date time Required"
Dim SelectFormula1 As String
SelectFormula1 = "{tblSample_Master.DateOut} in '" & StartDate & "' to '" &
EndDate & "'"
CrystalReportViewer1.SelectionFormula = SelectFormula1
CrystalReportViewer1.RefreshReport()
CrystalReportViewer1().ReportSource =
"D:\KOTITI\RptSummaryReportFromDateToDate.rpt"
thanx
Raj
--
Raj Kumar Mishra
jcast Networks Ltd.
New Delhi.
India.
91-51678212,13,14 Tag: String variabla to Integer of Long Tag: 46348
How to pass a Two Date parameter to a report at runtime using VB .NET
hi,
How to pass a Two Date parameter to a report at runtime using VB .NET
1. How do we pass multiple values eg. @Startdate, @EndDate to crystal
reports
parameter.
2. I have a report to filter by two dates like FromDate And ToDate
thanx
Raj
--
Raj Kumar Mishra
jcast Networks Ltd.
New Delhi.
India.
91-51678212,13,14 Tag: String variabla to Integer of Long Tag: 46347
Read the filename from the wdDialigsFileOpen dialog?
Dear all,
Does anyone know how to read the filename the user selects in the
default FileOpen dialog, into a variable?
I've tried this (in vain):
=================
Dim dlgA as Dialog
Set dlgA = Dialogs(wdDialogFileOpen)
With dlgA
.Show
varB = .Name
End With
=================
TIA,
AND Tag: String variabla to Integer of Long Tag: 46345
Error message received when accessing the clipboard using VBA
I'm looking to be able to access the clipboard contents using VBA. Here's some code which I got from this forum (guy name of Helmut posted it)
Sub R_clipboard_to_variable(
Selection.Cop
Dim o As DataObjec
Dim s As Strin
Set o = New DataObjec
o.GetFromClipboar
s = o.GetText(1
MsgBox
End Su
Now this doesn't really do a whole lot of anything, but the end result will have to do with re-writing the headers and footers of about 300 odd documents. When I run this code, though, I get a Compile Error: User-defined type not defined. As I understand it, the dataObject object should be integral to VBA and not something I have to declare a class for. My copy of VBA says it's version 6.3.8863. If anyone can shed any light on this (add-in needs installing, maybe?) then I'd be most obliged
Ganeth Tag: String variabla to Integer of Long Tag: 46332
Using {MACROBUTTON} fields to insert information from Outlook
Using Word 200 and XP, what is the code for using
{MacroButton} fields to insert Name, Address, (or
information from any other field) from Outlook into a Word
document? Tag: String variabla to Integer of Long Tag: 46320
Header/Footer
Maybe I was not paying attention but the code I used to create the header of
a document on the first page is not being used on subsequent pages.
Is there a way in code to tell it to do so? Tag: String variabla to Integer of Long Tag: 46318
Macros and persistence of Web tools modification
I received a Word 2000 document that contains macros. It is a
form with many checkboxes. The checkboxes are too big. I
can change their width and length using Web tools properties, but when I save and
close the document and launch it the next time, the
changes are gone. I suspect that the document's macro(s)
may be overwriting my changes. I have tried to find these
macros using Tools/Macros, but with no success. Can
anybody out there help Tag: String variabla to Integer of Long Tag: 46317
Context sensitive help
Are there any good tools for building context sensitive user help in VBA
applications ?
/BosseH Tag: String variabla to Integer of Long Tag: 46312
Step through template AutoNew macro?
I have a Word 2000 template with an AutoNew macro. This is called by a
macro in Excel. I need to make some changes to the Word macro, but I can't
seem to figure out how to step through it to see what's happening. I can
step through the Excel macro, but when it hits
Set WD = CreateObject("Word.Application")
WD.Documents.Add
the Word document and actions are invisible, and I can't see the steps.
Any suggestions?
Ed Tag: String variabla to Integer of Long Tag: 46305
Tables with borders.... i wish!
When I run a macro from my document in Word 97 a table is
created and the borders are automatically added but when
I perform the same operation in word XP the borders are
non-existant. I do not understand why, even though if
you insert a table manually the border are there (in
XP). Is this a bug or do I need to write a macro to draw
the lines back in. Is there a setting i'm missing? I
just don't know!!!! Please help.
Regards
Rob Tag: String variabla to Integer of Long Tag: 46304
adding text to a object
Would like to add a text string to the ThisDocument
Document_Open() procedure in a number of word documents
that have already been created. Would do this from a main
word document looping through the other docs. Need a start
on how to get the vba to recognize the procedure
Document_Open
thanks Tag: String variabla to Integer of Long Tag: 46299
How to add a "cloned document"
Hi all,
i have a word document and want to add a new one in Word. This new should
have the same text and format, the old one has. I am trying since
two hours, but have no idea how to "clone" documents. I tried to
"wholeselect" the old one and copy it to the new, but format-differences
from template, made in the old document, will not be copied.
In Borland Delphi i would do someting like this...
procedure Clone;
begin
NewDocument := WordDocument.Create;
NewDocument.Assign(OldDocument);
end;
but dont know how to do that in VBA. Maybe anybody else has an idea...
--
Erstellt mit M2, Operas revolutionärem E-Mail-Modul:
http://www.opera.com/m2/ Tag: String variabla to Integer of Long Tag: 46294
Nested tables and wdVerticalPositionRelativeToPage
Greetings;
I have some VBA that locates obects on a page and returns the
Selection.Information(wdVerticalPositionRelativeToPage) for further
processing.
I have noticed that if my selection is in a nested table, then
Selection.Information(wdVerticalPositionRelativeToPage) seems to return
the distance from the top of the inner table, and not the top of the
page as wdVerticalPositionRelativeToPage. You can notice the same thing
by watch the "At:" field on Word's bottom toolbar, when you enter a
nested table the field will claim you are higher that you are.
So, is there a way to get the valid vertical page information in nested
tables?
Thanks,
--Brian Tag: String variabla to Integer of Long Tag: 46292
Messed up help screen in VBA
Hi everyone,
My VBA help screen is messed up and I don't know what to
do to fix this. I even reinstalled Office 2000 SR1 and
this did not fix the problem.
The problem is that the links displayed at the top of the
Help screen (like Examples, Methods, Properties, etc.) are
all gone. I only see boxes with no text. Clicking on the
box does nothing.
I have tried to start Word using the RUN WINWORD /A method
and still no go.
Help!!!
Thanks,
George Tag: String variabla to Integer of Long Tag: 46290
large string in vba
Hi,
I try to use a large string in vba code
The string hold a "where" statement for a query.
The maximum charaters I can put into it is 251,
but the help file says the string datatype can hold up to 2^32 characters,
Somebody know what I'm doing wrong ?
Regards,
Patrick Tag: String variabla to Integer of Long Tag: 46289
Expanding a form
Hi All,
I am wanting to create a userform that can operate at two
levels. Simple and Advanced.
My intention is to add a commandbutton that when clicked
expands the centre section of the userform to reveal some
more advanced features.
I cannot figure how to achieve this. Has anyone any ideas
or pointers as to how I should proceed.
As always, I would be very grateful for any assistance.
Regards
Adrian Tag: String variabla to Integer of Long Tag: 46286
Determine if array contains no elements
I am using Word 97 with Windows 98. On initializing a user form I want
to fill a listbox with values from an array. The array is filled in
another procedure. When the array contains no elements however, the
listbox should not be shown. Right now my code is like this:
Sub Initialize_Userform()
On Error Goto Err_Handler
(...)
lboListbox1.List = Array1
(...)
Err_Handler:
If Err.Number=380 then
'Code not to show listbox
End If
End Sub
Error 380 occurs when you try to populate a listbox with an empty
array. Is there another way to determine if an array contains no
elements? I know I can use UBound() and LBound() to determine upper
and lower boundary, but that function also generates an error if there
is no element in the array.
I have searched this newsgroup, but I could not find an answer to my
question. Hope somebody can help.
Regards,
Johan Verdouw
Trainer / Microsoft Office Specialist Tag: String variabla to Integer of Long Tag: 46281
Is this possible ? Adding Checkboxex in to a table cell with VBA
I am creating a template which is basically a table.
I want to know if it is possible when adding a row to my table to
basically populate a cell with a check box, this will be happening for
every row added. No bookmark is required as i scan the rows for the
state of the checkbox on calculation stage
I have been trying to do this .. and been using form fields..but cant
see my checkbox appear...
can some one point me in the right direction or syntax for the command
i need to use
many thanks to all who read / reply
de vo
--
remove the obvious capitals in my m@il address to send directly Tag: String variabla to Integer of Long Tag: 46278
CLOSING OF WORD FILE
hi ,
Any one can give me the solution for " HOW TO CLOSE THE WINWORD FILE USING
VB.NET AND MS-WORD.
THANKS
RAJ
--
Raj Kumar Mishra
jcast Networks Ltd.
New Delhi.
India.
91-51678212,13,14 Tag: String variabla to Integer of Long Tag: 46277
return the text from a numbered title (list)
Hello,
I would like to be able to *easily* retrieve the text from
a numbered list paragraph (title), which is also a
bookmark.
E.g. from the following line
2.3.1 Dummy title
I would like to retrieve "Dummy title". The bookmark would
contain [Dummy title].
This seems rather simple by using something like:
Dim bm As Bookmark
For Each bm In ActiveDocument.Bookmarks
Debug.Print bm.Name, bm.Range.Text
Next
However, the paragraph might contain a manual page break
(because a user has entered one), which causes the
bookmark to start just before this manual page break.
This, of course, will make the bm.range.text property also
return the page break (which i don't want). In the debug
screen it's visualised as a little square, but when the
string is pasted somewhere in word, it does contain the
pagebreak.
Does anybody knows how to *easily* get just the text?
Ward
Ps: I've found a workaround to get what i want (see
below), but it's way to complicated. I figure it should be
possible to do it more simple.
'Check if the paragraph is preceded by a 'manual page break
'because this should be removed from the range
If Left(Rng.Paragraphs(1).Range, 1) = Chr$(12) Then
If mDoDebug Then Debug.Print "Pagebreak before"
Rng.SetRange Start:=Rng.Start + 1, End:=Rng.End
End If
'Do not include 'enter' at the end of the line
Rng.SetRange Start:=Rng.Start, End:=Rng.End - 1
'save range for later handling
Set mTargetParRange = Rng
'Return header/paragraph text
RtrnParagraphText = Trim(Rng.Text) Tag: String variabla to Integer of Long Tag: 46275
Disabling select in office document
Hi
I have written an application in C# that converts values in a form, into a well formatted word document (using office automation object)
I would like to protect the contents of the document. I have done the same through enabling protection (.protect method) of the document
But I observed that the user is still able to copy text from my word document and paste it into notepad, word etc. I do not want this to happen
How do I go about doing the same
Thank you in advance
Manis Tag: String variabla to Integer of Long Tag: 46268
Password Prompting need for data entry in table cells
I am utilising a shared word document with a table that is accessed b
multiple users. Is it possible to define a macro that will only allo
access to given cells, providing the password was imputed correctly.
The table document has to be viewed by all, but only individual cell
modified by given users. Please Help
-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com Tag: String variabla to Integer of Long Tag: 46264
Read and Write Word file
Hi ,
I am working on vb.net and word application automation application.
my question is :.
1. I want to save one file into another file ,
example.
a) my existing file name is "Raj.DOc" and containing some page.
b) and second file is "Raj2.DOc" it also containing some page.
c) So I want to Save "Raj2.Doc" file into "Raj.doc" file. with all the
page
Please help me out with code.
i will be very grateful to you.
Thanks and Regards
Raj Kumar Mishra
jcast Networks Ltd.
New Delhi.
India.
91-51678212,13,14
--
Raj Kumar Mishra
jcast Networks Ltd.
New Delhi.
India.
91-51678212,13,14 Tag: String variabla to Integer of Long Tag: 46263
running Word commands
1. 'What is the best way to run a built-in Word command from VBA?
2. Why do some built-in commands run successfully, and others don't?
If I run:
Application.Run MacroName:="WordRight"
it works
If I run Application.Run MacroName:="StartOfWindow"
it doesn't work. I get an error message or nothing happens.
Larry Tag: String variabla to Integer of Long Tag: 46256
Looking for advise.. and help !!!
Hi
Can some one point me in the right direction because the more i read on
the forums and web the more I not too sure how i should tackle a problem
This is my first vba project which i have being trying to work out.
I have a table with 4 columns 1-3 are data and nett wages is caculated
value
Employees Name ; Gross Wages ; +/- deduction % ; nett wages
test user 100 +17.5% £ 117.50
test user 2 100 -20% £ 80.00
basically i need to figure out the best way of doing it.
The vba method by reading the values and creating a calculation for
each row
or i have been reading about the SEQ method of creating a formula to
step down the rows.
I have been able to get anything really to work..
with method one the vba i been able to read the cell but havent got the
caculation right.
and the other method of having the formula in the cell.. the notes
about seq has made my head hurt.
So can i ask for some light and guidance....
.... many thanks
De Vo
--
remove the obvious capitals in my m@il address to send directly Tag: String variabla to Integer of Long Tag: 46252
Need some sort of AutoExec (maybe)
Apologies if there's a better group I could post to.
Word2000 + Win2000 or XP
I have a couple of mail merge documents that are recreations of some
forms from our company. Each contain some checkboxes. I employed the
method using AutoText/Macrobutton outlined by several posts I've seen to
toggle those checkboxes with my mouse -- with a couple of twists.
In order to use a single mouse click AND have the ability to use the
method on a file that I've created via 'Merge to new document', I have to
not only had to Attach the template to each of the two documents, but Add
the template to make it global and add some code to the template's
ThisDocument/Open routine to fire the template when I open either parent
or merged document and make single clicking work. Here are the routines
for that template as they stand.
ThisDocument:
Private Sub Document_Open()
AddIns("C:\data\word\CheckBox.dot").Installed = True
Options.ButtonFieldClicks = 1
End Sub
ChkBox Module Subs:
Sub CheckIt()
ActiveDocument.AttachedTemplate.AutoTextEntries("Checked Box").Insert
Where:=Selection.Range
End Sub
Sub UncheckIt()
ActiveDocument.AttachedTemplate.AutoTextEntries("Unchecked Box").Insert
Where:=Selection.Range
End Sub
Everything works exactly as desired, so I guess I shouldn't complain, but
there is one tiny cosmetic flaw. When I open the menu Insert | AutoText,
I see TWO entries each for 'Checked Box' and 'Unchecked Box'. Aargh!!!
I wrestled all weekend to adjust the file placement and code to both load
the template and fire the Document_Open routine so I could eliminate the
need to Attach the template to each file and still have the ability to
single click in all files and reduce the AutoText entries to a single
instance. No matter what I tried, there was always one piece of the
puzzle missing.
Any help? I want to have my cake and eat it too!!
One caveat: I want the template to remain in C:\Data\Word for two
reasons: 1) I backup this folder to two other machines daily and 2) since
the AddIns() line requires the full path, if I placed it in Word\Startup,
that's a looong path and unique for each machine.
--
David Tag: String variabla to Integer of Long Tag: 46250
PageSetup object: changing papersize changes also orientation?!
Hi everybody
I have a problem with a document template. The orientation of my template is set to landscape. When users opens the template, the code will check the preferred papersize from users settings (I'm having my own configuration utility for templates to set all defaults like interface language, papersize etc.).
In previous Word version (97 and 2000) changing papersize had no effect to the page orientation but now in Word 2002 when I'm changing the size through code i.e. from European A4 to US Letter, Word also changes the orientation of the page from landscape to portrait! If I do the same thing manually from File/Page setup menu, orientation does not change
The next problem is, that I cannot change the orientation programmatically back to landscape, because there is a bug in Word. An article in knowledgebase says (http://support.microsoft.com/default.aspx?scid=kb;en-us;275966)
-----------------------------------------------
"In Microsoft Word 2000, when you run a Microsoft Visual Basic for Applications macro that accesses the PageSetup object from the Document object or the Section object, you receive the following error message: Run time error '4605'. This command is not available. This problem can occur if all of the following conditions are true:
Your document contains a frame (not to be confused with an HTML frame or a frame page)
-and
The frame contains a table
-and
The frame is anchored to the first paragraph in the document
-and
You run a Visual Basic for Applications macro from Word, accessing the PageSetup object from the Document object or the Section objec
-------------------------------------------------
Unfortunately my case meets all these conditions. The same article says, that this problem is corrected in Word 2002. This is not true, because I'm having the same problem in Word 2002. In Word 2000 this bug did not cause any harm in my template, because changing the papersize did not have any effects to orientation.
Does anyone have solution or hint for this
Regards
E. Lehto Tag: String variabla to Integer of Long Tag: 46245
Can't reference a .dot via code
Hi
I'm trying to reference in a .dot template file with code ('code.dot') into another template file ('test01.dot').
I use this code (both files are in the same directory):
test01.dot
[code]
Private Sub Document_New()
Dim msgBoxen As Variant
ThisDocument.VBProject.References.AddFromFile Templates(1).Path & "\code.dot" 'referencing the code file
msgBoxen = MsgBox(Templates(1).Path & "\code.dot is the path", vbCritical) 'Debug code to show the path
Test 'Trying to call a sub from the reference file
End Sub
[/code]
code.dot
[code]
Public Sub Test()
Dim msgBoxen As Variant
msgBoxen = msgBox("Hello", vbCritical)
End Sub
[/code]
When I use the test01 template i get this error:
Compile error:
Sub or Function not defined
Do I have to activate the reference code in some way?
When I reference the code via Tools -> Reference it works fine.
I have also tried to use the absolute file path in the reference code, but it still dont work.
What have I done wrong?
Ps
I have tried to repy with this question in a previous thread but it didn't work, so I'm sorry to have to create a new one. :/
Ds Tag: String variabla to Integer of Long Tag: 46244
processing multiple word files to save as html
Is there a way I can open multiple Word documents in a folder (C:\WordDocs\input, for example), save them as Compact HTML (I've downloaded MSFilter.dot), then save the resulting HTML files in a different folder (C:\WordDocs\output, for example)?
I tried using the Batch Conversion Wizard (File > New, then "Other Documents" tab, then selecting "Batch Conversion Wizard, but I don't have access to it. Plus I'm on a network, and don't know if/when I can get this feature installed, so finding an alternative is probably going to be my fastest solution.
Thanks. Tag: String variabla to Integer of Long Tag: 46237
Envelope objects Feedsource Property
Hi All,
I am working with Word's Envelope object and I've found
some bizarre behavior. This is totally dependent on the
print driver. When you query a print driver using the API
call getdevicecaps it returns printer tray ids as longs. I
can then set the Envelope.feedsource = to one of these
tray id's. All is good in the world, until. If the print
driver returns anything above a number 15, setting this
property will fail. Now for the bizarre part. If you query
this property for the default tray and it happens to be
above 15 it won't fail. So I have a situation where the
property = 257 and when I try to set it to 257 I get a
message telling me that the parameter is outside of
acceptable limits. Anybody else run into such a beast? Tag: String variabla to Integer of Long Tag: 46236
finding just docname in File search
I'm using a file search and I want to be able to seperate a docname from a path
name in the found files? Is there a way to do this without looking for
backslashes from right to left? I want to be able to change the names of actual
docs, and cant if I don't know the docname without the path name of
subdirectory name.
spammastergrand@aol.com Tag: String variabla to Integer of Long Tag: 46233
merging pdf files trough Word VBA -> possible?
Hello,
I'm developing an Word add-in the will create one Word
document from several Word documents. This file will then
by converted (printed) to a pdf using PdfWriter. No
problem with this first part.
However, I would like the add-in to append some existing
pdf's to this final pdf. So the whole operation would
result in one (large) pdf file that originates from a
couple of word files and a couple of existing pdf files.
I'm not sure that this (appending extra pdf's) is possible
through Word VBA. Does anybody has any idea about this?
thanks in advance,
Ward Tag: String variabla to Integer of Long Tag: 46230
spellchecking again
Hey there,
with the help of some guys here, I managed to create an automated list
of spelling errors in word documents.
I used the following code:
--------
Sub ListSpellingErrors()
Dim lngSpellErrCnt As Long, n As Long, FFile As Integer
lngSpellErrCnt = ActiveDocument.SpellingErrors.Count
FFile = FreeFile 'DateiHandle
Open "C:\SpellErr.txt" For Output As #FFile
For n = 1 To lngSpellErrCnt
Print #FFile, ActiveDocument.SpellingErrors(n).Text
Application.StatusBar = n & " / " & lngSpellErrCnt & " Fehler
verarbeitet..."
Next
Close #FFile
End Sub
--------
It works quite ok, actually, but it's unbelievably slow. Can anyone tell
me why?
Thanks,
Sebastian Tag: String variabla to Integer of Long Tag: 46229
Hi,
What is the function for converting String variable with
number to Integer or Long variable?
"Sasa" <anonymous@discussions.microsoft.com> wrote in message
news:12a9c01c3f6c0$7bb04850$a001280a@phx.gbl...
> Hi,
> What is the function for converting String variable with
> number to Integer or Long variable?
>
> Thanks.
>
> Sasa