Find/Replace only supports alphabetic characters?
I'm trying to do a find/replace by automating Word from a C# application.
It works fine as long as my find/replace text is alphabetic. If I try to do
a find/replace using a string such as "C#", I get an error: "The Find What
text for a Find All Word Forms search can only contain alphabetic letters.".
I tried enclosing the string in quotes, but that doesn't work either. That
actually will cause the problem with text that otherwise works - it doesn't
like the quotes either.
Here's my code (this code highlights all instances of "text" in red/bold):
Object oReplaceAll =
Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll;
Object oText = text;
Object oReplaceText = text;
wordDoc.Select();
msWord.Selection.Find.Text = oText.ToString();
msWord.Selection.Find.Replacement.Text = oReplaceText.ToString();
msWord.Selection.Find.Replacement.Font.Bold = 1;
msWord.Selection.Find.Replacement.Font.Color =
Microsoft.Office.Interop.Word.WdColor.wdColorRed;
msWord.Selection.Find.Execute(ref oText, ref oFalse, ref oFalse, ref
oFalse, ref oFalse, ref oTrue, ref oTrue, ref oFalse, ref oTrue, ref
oReplaceText, ref oReplaceAll, ref oMissing, ref oMissing, ref oMissing, ref
oMissing);
You can do what I want from within word itself - how do you call
find/replace and allow non-alphabetic characters?
- Dave Tag: How to delete from first page to start of the next section break Tag: 58132
Is VBA/Word slow...or is it just the way I did it?
I have created what I believe to be a rather complex document/program in word
(I believe there are over 13000 total lines of code). I have quite a few
auto-text entries that either are, or contain graphics. The overall size of
my Word Template (one I created specifically for this purpose, not
Normal.doc) is quite close to 8 Megs. The document doesn't seem like it
takes excessivly long to open, or for the first UserForm to appear as a
reault of the AutoNew Macro which calls the form. It seems like it takes
excessively long for 1) items to be transferred from the userform comboboxes
and text boxes to the FormFields in the template, 2) the userForm to unload,
and 3) the 2nd userform to load. Then it seems to take excessively long for
the same things to occur with the 2nd userform. Tag: How to delete from first page to start of the next section break Tag: 58131
Template Macro to Save Documents
Iâ??m recording a macro, within a template, that will save the values of the
bookmarks as part of the file names. While Iâ??m recording I get the save as
dialog box to show but the file type says template.dot. I donâ??t want to save
the template file, .dot, within my macro, I want the .doc file to be saved.
If I change the file type to .doc and change the file location, away from
the template subdirectoy, the macro disappears when I go to reopen the
template. Word doesnâ??t allow me to stop the macro when the SaveAs dialog box
is open. Pressing the cancel button in the SaveAs dialog box, records the
cancel within the macro. (Iâ??m also recording encryption in the Save As box
but that seems to work fine.)
How can I save the macro in the template and still save the file as a
document? (Leaving the Save As dialog box open with the proper file location
and file name where all the user has to do is press Save is great?)
Thanks,
Phil Tag: How to delete from first page to start of the next section break Tag: 58129
Adding shapes...
How can I add a shape at the current cursor position using VBA? I would
like to add a small rectangular box. Is this possible?
Thanks Tag: How to delete from first page to start of the next section break Tag: 58124
PrivateProfileString Long Key Values
I recently read several postings on how to create a GetINISetting function
that would replace the System.PrivateProfileSetting function, which is
limited to 255 characters. The function shown retrieved a long string value,
which helped me out a lot. How can this be modified to 1) write to the INI
file to append a new INI Key value that is longer than 255 characters or
replace an existing INI Key value with a new value, that is longer than 255
characters?
The original function was...
Function getIniString(file As String, section As String, key As String)
Dim nr As Long
Dim curLine As String
nr = FreeFile
Open file For Input As nr
' read until section is found
Do Until EOF(nr) Or LCase(curLine) = "[" & LCase(section) & "]"
Line Input #nr, curLine
Loop
' read until end of file or key is found
Do Until EOF(nr)
Line Input #nr, curLine
' key found?
If LCase(curLine) Like LCase(key) & "=*" Then
' yes -> outta here
getIniString = Mid(curLine, Len(key) + 2)
Exit Do
End If
Loop
Close nr
End Function
Thanks in advance for your help. Tag: How to delete from first page to start of the next section break Tag: 58123
Re: FileSystemWatcher getting Word temp file
From: "zfeld" <zfeld100@hotmail.com>
Subject: Re: FileSystemWatcher getting Word temp file
Date: Tuesday, October 19, 2004 12:29 PM
Thanks,
What I discovered is that the temporary ~$documentName.doc never gets
renamed, it is just deleted on close. However another file is created at the
same time as the ~$documentName.doc that doesn't even have the .doc
extension, which was why I wasn't seeing it, it is usually something like
wrd005.tmp this then gets subsequently renamed into MyDocument.doc. I
therefore had to ignore the creates of .doc files that start with ~ and
catch renames from a .tmp extension to .doc extensions.
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in
message news:1m8bffq8zpl5x$.pwpz8yof3ekv$.dlg@40tude.net...
> On Mon, 18 Oct 2004 11:20:56 -0400, zfeld wrote:
>
>> My app is creating a word document which my app calls saveas() and saves
>> it
>> to a given directory that is being watched by a fileSystemWatcher. The
>> problem is that the fileSystemEventHandler for creation is only called
>> for
>> the temporary filed created by word which shows up as ~$documentName.doc
>> the
>> real file named MyDocument.doc will never invoke the
>> fileSystemEventHandler
>> for creation. Now when the user closes Word the temporary file is deleted
>> and my app only had a handle to that file.
>> How come I am not getting any notification about the creation of the real
>> file even though it was saved using saveas() and I do see it created in
>> windows explorer?
>
> Off the top of my head, I would say that the temp file is being created
> and
> then renamed to the final filename. When a file is renamed, a create is
> not fired for the new name. Try setting up your FileSystemWatcher to
> handle the rename event.
>
> --
> Chris
>
> dunawayc[AT]sbcglobal_lunchmeat_[DOT]net
>
> To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
> replace certain words in my E-Mail address. Tag: How to delete from first page to start of the next section break Tag: 58121
fill in a new field using data from a field already filled out in.
I have a contract that has multiple fields. This contract is protected and
given to reps to fill out. They have to fill in the customer name several
places in the document, and I would like for them to be able to fill it in
once, and have the rest automatically fill in. How can this be done? Tag: How to delete from first page to start of the next section break Tag: 58119
Footer Update
Hi
I have a footer in my word document which display the
document title - when I change the document title it does
not update my footer automatically. I don't really want
my users to have to open the footer and use F9
I added this procedure which was working fine but I guess
I have accidentally changed something as it no longer
works but shows me an error (No errors if I open the
template but the following error msg if I open any docs
based on the template) error msg is:- run time error 91 -
object variable or with not set
Please see my code below
Private Sub Document_Open()
'move to page 2 of the document
Selection.HomeKey unit:=wdStory
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext,
Count:=1
'update fields in the header
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
Selection.HeaderFooter.LinkToPrevious = True
Selection.WholeStory
Selection.Fields.Update
'update fields in the footer
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageFooter
Selection.HeaderFooter.LinkToPrevious = False
Selection.WholeStory
Selection.Fields.Update
'Close Header Footer view & return to the top of the doc
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.HomeKey unit:=wdStory
End Sub Tag: How to delete from first page to start of the next section break Tag: 58111
Saving file to new locating and deleting old file
There are a large number of files in various locations that will have to be
saved to a new location (C:\Employees). I was wondering if it was possible to
create a macro that would save the currently open file to C:\Employees and
then delete the file from the original location (for e.g. C:\Tom)?
Any help would be greatly appreciated. Thank you. Tag: How to delete from first page to start of the next section break Tag: 58108
Word Context Menu's
Getting some serious brain ache over this ;)
(OS=XP Pro, Word=11.0)
My set up is as follows. I've a document template (myForm.Dot) which
contains code to add items to the Context menu's.
The code for each item is as follows:
Set cb_ctl =
CommandBars(ShortCutMenu(i)).Controls.Add(msoControlButton)
With cb_ctl
.Caption = "Use ET" 'Changes for each button
.OnAction = "=fUseET()" 'Changes for each button
End With
When I open a new document (based on the template) the menu items are added
to the context menu (yay!)... however, when I click on each item I'm not as
lucky.
I receive the message (and apologies in advance for its length):
------------------------------ SNIP ----------------------------------------
You may encounter this error for the following reasons:
Macro security is set to:
Very High and the application encounters a signed macro, but the macro was
automatically disabled. Use the following procedure to enable the macro:
Select the Tools menu option and then select Macro and Security. In the
resulting Security dialog, set the security level to High by clicking the
High radio button.
Close the file and any other instances of the application currently running
on the computer (close all applications that also use the application you are
currently running).
Open the file again and examine the certificate of trust details and set the
Always trust macros from this publisher box if you trust the certificate
issued by the publisher.
Click the Enable button to allow the macro to run.
High and the application encounters a signed macro, but you selected Disable
when prompted by the macro warning dialog when opening the file. Use the
following procedure to enable the macro:
Close the file and any other instances of the application currently running
on the computer (close all applications that also use the application you are
currently running).
Open the file again and examine the certificate of trust details and set the
Always trust macros from this publisher box if you trust the certificate
issued by the publisher.
Click the Enable button to allow the macro to run.
High or Very High and the macro was not signed and was automatically
disabled by the application. Use the following procedure to enable the macro,
if you have verified you can trust the source of the unsigned macro:
Select the Tools menu option and then select Macro and Security. In the
resulting Security dialog, set the security level to Medium by clicking the
Medium radio button.
Close the file and any other instances of the application currently running
on the computer.
Open the file again and click the Enable button when prompted to allow for
the unsigned macro to run.
When you have accepted the macro, return the macro security level to its
previous setting.
Another instance of your application has a lock on the security settings and
is disallowing any changes to security settings.
It is recommended to close all Office related applications or other
instances of the same application when you attempt to make changes to your
security settings.
Visual Basic for Applications (VBA) is not installed on your computer.
If VBA is not installed, it is not possible to accept certificates of trust
attached to VBA macros. Therefore, any VBA macro attempting to run, even with
an attached certificate of trust, cannot be run because the necessary macro
interpreter is not installed on the system. Two scenarios can cause this
error:
Your administrator chose not to install VBA
The version of Office you are running does not install VBA by default
If you are running an instance of Office that does not provide VBA as an
installable feature, you will need to upgrade your version of Office to run
VBA macros.
The certificate of trust is invalid - (when this occurs, you cannot select
the Enable button).
The certificate is no longer trusted, was revoked by the issuing authority,
or is damaged. There are several other possibilities which you may need to
explore as to why the certificate is no longer recognized as valid by your
system. It is recommended that you not trust or run a macro that has an
invalid certificate.
A troubleshooter help topic is available online regarding this issue.
------------------------------ SNIP ----------------------------------------
After revewing the items in the list, I conclude that none apply to my set
up (Macro settings are medium, VBA obviously installed, certificates are
valid etc).
The Cruncher... where've I gone wrong!
Also, just for kicks... how the heck do I add in images to these buttons
through VBA? I cant seem to find any properties for this... As an
alternative I've seen the PasteFace function that'll use the clipboard
contents, but I've no idea how to get my icon file onto the clipboard,
programatically.
****************************************
Laugh, and the world laughs with you. Trip over in the middle of a busy
shopping centre whilst briefly holding a thick vaniilla shake, and watch the
world have hysterics at your expense.. Tag: How to delete from first page to start of the next section break Tag: 58105
Set Range using Find
This seems simple but I'm struggling since I've always used selections rather
than ranges. I want to set multiple ranges based on search criteria.
For example, the macro will search for QUESTION 1.1. Then I want to set the
range to be the pargraphs between QUESTION 1.1 and RESPONSE TO QUESTION 1.1.
(Note I want to capture the question, not the response.)
Thanks! Tag: How to delete from first page to start of the next section break Tag: 58096
Corrupt Form?
Word 2000
In the last 2 days I have started getting the following error message when I
try to save my project:
The disk is full. Free some space on this drive, or save the document on
another disk.
Try one or more of the following:
* Close any unneeded documents, programs, and windows.
* Save the document on another disk.
The problem is NOT with disk space (I currently have over 1 GB of free drive
space). The problem is not with the hard drive itself (I ran ScanDisk and
defragged). If I try saving to another drive, I get the same message.
I noticed that if I remove a certain form from the project, the problem goes
away. If I import that form again, then problem comes back. I can do this
over and over, and the results are always repeatable--remove the form and
the problem goes away, bring back the form and the problem comes back.
So it looks like a problem with a corrupt form. I have a couple of
questions:
1) Could it be something other than a corrupt form?
Assuming that it is a corrupt form...
2) Is there a way to repair the form without rebuilding it from scratch,
like by running a code cleaner on it?
3) Are there any practices that I should be following to make sure my forms
don't become corrupt?
Any other information that anyone can offer will be greatly appreciated.
BTW: I'm currently in the process of moving everything into a new template
in case this is an issue with a corrupt project, but this one form seems to
be the stumbling block. It wouldn't be a big issue to rebuild the form
completely, but I'd like to get answers to my questions anyway, if possible,
just for my own knowledge if for no other reason.
-- Tom
State of Montana
Department of Justice Help Desk
"Making the world a safer place." Tag: How to delete from first page to start of the next section break Tag: 58094
WordBasis insert command -- text length limit
I am using following code to insert text into the word document, using VB
from excel.
Any text which has length more than 240 characters is not getting inserted
into the document.
Any suggestions are highly appreciated.
Thanks,
----------------------------------------------------------------------------
------------------------------------
Sub GenerateADRFinding()
' Dimension the variables.
Dim PokeRange As Object
Dim Chan As Integer
Dim i As Long
Dim temps As String
Dim insertS As String
' Create an range object to poke.
Set PokeRange = Range("CheckList!a1")
' Initiate a channel to Word using a file as the topic.
Chan = DDEInitiate("WinWord", templateFile)
' Execute a few WordBasic commands.
DDEPoke Chan, "\StartOfDoc", PokeRange
i = 0
Do While i < 240 9 '(> 240 does not work)
temps = temps & "1"
i = i + 1
Loop
insertS = "[Insert "" " & temps & " "" ]"""
DDEExecute Chan, insertS
'DDEExecute Chan, "[FileSaveAll]"
DDEExecute Chan, "[FileExit]"
' Terminate the DDE channel.
DDETerminate Chan Tag: How to delete from first page to start of the next section break Tag: 58092
Auto Configure Startup Folder
Hi All,
Is it possible to auto configure MSWord to find a Startup folder on a
network drive when a new user logs onto a computer?
Currently I have to explain to a new user how to configure Word to find
the Startup folder on the network because Word defaults to the newly
created personal folders on the Local HDD.
John D. Tag: How to delete from first page to start of the next section break Tag: 58091
Word could not fire the event
I'm trying to automate a Wordprogram. The asp part starts with
Dim oApp
Dim oDoc
Dim oMergedDoc
Set oApp = CreateObject("Word.Application")
Set oDoc = oApp.Documents.Add
The "CreateObject" statement seems to be very touchy. If another instance
of WINWORD is left in the Processes, it causes Error 429: ActiveX component
can't create object. Also, I found that the files Asyncfilt.dll,
Oleaut32.dll, OlePro32.dll, and StdOle2.tlb should have the same build
number; they did not and also caused Error 429. I found new versions of the
first three files to download but not forStdOle2.tlb. CreateObject now works.
Alas, the oApp.Documents.Add statement now gives error 6002, Word could not
fire the event.
So far the Knowledge Base has been no help. Does anyone have any
suggestions?
I'm running Windows XP Prof.(SP2), Office 2003 (SP1), FrontPage 2003(SP1),
VB6.0 (SP6), Works Suite 2003, and have WindowsScript 5.6 installed. I have
checked the Word.Application key in the registry and the Normal.dot template. Tag: How to delete from first page to start of the next section break Tag: 58088
FileSystemWatcher getting Word temp file
My app is creating a word document which my app calls saveas() and saves it
to a given directory that is being watched by a fileSystemWatcher. The
problem is that the fileSystemEventHandler for creation is only called for
the temporary filed created by word which shows up as ~$documentName.doc the
real file named MyDocument.doc will never invoke the fileSystemEventHandler
for creation. Now when the user closes Word the temporary file is deleted
and my app only had a handle to that file.
How come I am not getting any notification about the creation of the real
file even though it was saved using saveas() and I do see it created in
windows explorer? Tag: How to delete from first page to start of the next section break Tag: 58082
AP Modules - Are there any?
I am searching for AP Modules to use with MS Word. Does anyone know of any
available?
I would appreciate any links, information, etc. that you have to offer on
this topic.
Many thanks. Tag: How to delete from first page to start of the next section break Tag: 58080
How set up an interactive date showing today + 7 days?
I need to set up an interactive field, preferably in word which will show me
today + 1 week from now so today + 7 days?
Any help,
Stefan Tag: How to delete from first page to start of the next section break Tag: 58077
Allowing user to set what and how many selections?
We work with a lot of engineering documents. Each doc has basically the
same general format, but specifics differ enough betweens sections that a
one-size-fits-all template isn't possible. I can pull all the info out of
the database to create the docs (this must be done through Word VBA; the
database itself isn't capable of doing this). Each report doc is created as
a plain text doc with no formatting.
What I'm trying to do now is figure out the creation of an index table (as
an Excel doc) that each section can customize. The info populating the
index table would be pulled from each report doc as it is created. But
each section's table will be different. For example, one section may want
the data in Blocks 10, 12, and 15A in their index, while Block 15A may not
even exist on another section's report. I'm trying to figure out how to let
one administrator from each section customize their index format - what they
want and how many data blocks they want to retrieve, rather than being the
one person to create an individualized index table for each section, and
customize it every time they change their mind!
I'm considering popping up a modeless UserForm that will allow the user to
select (in typical opened report) the headers of the blocks, the number of
spaces the retrieved data will span, and then enter a title for that data
field. For instance, if the report has
15A. TEMP: 13 deg C
the user can select
15A. TEMP: and click a button on the form, which will set that text as a
search string, then enter 8 spaces (for the retrieved data length) in a text
box, and then enter a title in another text box. All of this search info
could be written into a table saved in a doc associated with the UserForm,
and read back into strings in a Form_Initialize event. This would allow the
user to set up a table as big or small as desired. Then, when each report
doc is created, the code searches for the selected string, then extends the
range the specified number of spaces and selects that text to write into the
Excel table.
Does all this sound like a good way to go? Or am I doing things the hard
way? Is there a better way to consider?
Ed Tag: How to delete from first page to start of the next section break Tag: 58073
In VB what is the code to change a date from 10/10/04 to Oct...
I have a vb form with a txtbox field which asks for a Date Received = txtDtRcv
If user enters 10/10/04 I would like it to be formatted for October 10,
2004. How do I accomplish this? Tag: How to delete from first page to start of the next section break Tag: 58063
VBA To Change Page Numbering in Header...
Hey gang,
Got sort of a unique one. I'll try to explain without getting long-winded.
I have a procedure-type document with page numbering in the Headers. Some
times we need to insert a change to the procedure that forces a new page.
This new page needs to have a ".1" added to the Header page numbering. For
example, if I need to add a new page (section break - next page) between
pages 10 and 11, my page numbering will end up being 10, 10.1, and 11.
I have recorded a macro that has automated the insertion of two section
breaks, turned off "Same as Previous", but I need to do the following:
1. On the new page, change the existing "field" page numbering from the
existing number (in this case 11) to a hard-typed "10.1".
2. On the page that goes back to regular numbering, change it's new number
(12) back to 11.
I know it is quite easy to select the first page number and delete it by
typing the actual page number I want, and going to the next section header
and selecting the page number and changing it to "Start at...11", but I was
hoping I could automate this for my staff (who aren't the most literate of
word-processors)! HA! Sine this new page added could be anywhere, I am
hoping to be able to look at the existing page number and change it to
"Start at..." one less that it shows now. Not sure if this can be done.
Especially with my limited VBA knowledge!
Any ideas would be greatly appreciated. If you want me to post the recorded
code I have for the Section breaks, holler back.
TIA!
--
Bill Foley, Microsoft MVP (PowerPoint)
Microsoft Office Specialist Master Instructor - XP
www.pttinc.com
Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
Check out Word FAQs at: http://word.mvps.org/FAQs/General/index.htm Tag: How to delete from first page to start of the next section break Tag: 58062
Apply formatting taken from one object to another?
Hiya,
I have a mergefield which I am dynamically replacing with a link in my code.
Even though the link says "\* MERGEFORMAT", it still does not retain
formatting when embedded in the document. So, I'm having to change its
formatting after it has been embedded.
So basically, how can I say something like myLink.Formatting =
myMergeField.Formatting - so that the embedded link has the same
font/formatting etc. as the mergefield I'm replacing with it.
Thanks
Robin Tag: How to delete from first page to start of the next section break Tag: 58061
Save As Macro with File Name
Is it possible to write a Save As Macro that I can run on exit from a form
field tht will prompt the user to Save As and also put in a filename
(standard filename that they can then amend). Let them save then continue
going through the form fields? Many many thanks. Sally T Tag: How to delete from first page to start of the next section break Tag: 58060
Word 97: keyboard assignment doesn't come into effect
Dear all,
Here I've got a problem which doesn't seem to exist in Word XP, but
unfortunately some of 'my users' still work with Word 97 and there it does.
I experience this problem using VBA code, but the same seems to happen when
I try it by hand. (Tools Customize Keyboard...)
I want to assign Alt-Ctrl-W to the macro PrintAndCloseFiles (which resides
in a module that has been copied to Normal.dot) using this code:
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyW, wdKeyControl, wdKeyAlt), _
KeyCategory:=wdKeyCategoryMacro, _
Command:="PrintAndCloseFiles"
(for the last I also tried "Normal.ModuleOpenClose.PrintAndCloseFiles", but
this makes no difference)
After running this code Alt-Ctrl-W remains for some exotic character, which
seems to be the default assignment.
A I told you the same holds for doing this by hand.
I would be very happy with some explanation and above all: solution!
Thanks in avance! Tag: How to delete from first page to start of the next section break Tag: 58057
Using checkboxes to create an action list
I'm writing a question and answer template in Word 2000 to gather
requirements for a project.
There are certain questions where the answer is not currently known and
these need to be converted to action points for the upcoming project.
The template currently has a load of questions with text boxes to gather the
answers but what I want to do is add a checkbox and a textbox to each of
these to determine whether an action is required and who that should be
assigned to.
Is it possible to put some code behind these boxes so that if the check box
is ticked then the details of the text box with the answer in and the text
box with the name of the person the action should be assigned to is added to
another section of the document?
Any help would be much appreciated.
Simon Tag: How to delete from first page to start of the next section break Tag: 58056
Normal.dot seems to change MyTemplate.dot
Hi
I've made up a template with macros and it is called MyTemplate.dot
I thought that it would be independant of Normal.dot and that I could change
the loading of my personal menu and commands etc without the two dot files
interfering with each other.
But when I change sth in MyTemplate.dot , then Normal.dot is changed as well
or visa versa
Have I got a wrong idea or have I done sth wrong?
Thanks
Dave Neve Tag: How to delete from first page to start of the next section break Tag: 58055
Running functions
Hi
The macro below is apparently recursive and can cause
a computer to run out of memory. But how do you run
it as it doesn't seem to execute from VBA Editor and the macro doesn't
appear in VBA explorer.
Does a function have to be called from another sub or something?
Thanks
_____________________________________
Function
RunOut(Maximum)
RunOut = RunOut(Maximum)
End Function
_______________________________ Tag: How to delete from first page to start of the next section break Tag: 58047
How many Sub AutoOpen() can you have in one document
Hi
If I want to have more than one thing to happen automatically when I open a
document, how to I do this.
I already have a 'sub AutoOpen' macro and I wanted to add a second one but
their is an 'ambiguity of name window'
Thanks in advance Tag: How to delete from first page to start of the next section break Tag: 58043
Normal.dot seems to change MyTemplate.dot
Hi
I've made up a template with macros and it is called MyTemplate.dot
I thought that it would be independant of Normal.dot and that I could change
the loading of my personal menu and commands etc without the two dot files
interfering with each other.
But when I change sth in MyTemplate.dot , then Normal.dot is changed as well
or visa versa
Have I got a wrong idea or have I done sth wrong?
Thanks
Dave Neve Tag: How to delete from first page to start of the next section break Tag: 58042
AutoExit() won't execute
Hi
Why won't this simple bit of code work.
I'm trying to understand 'automatic macros'.
It works if I execute it in VBA but not when I close the doc or Word.
Thanks
__________________________________________________
Sub AutoExit()
MsgBox "Have a Nice Day", _
vbOKOnly + vbExclamation, "Dave Neve"
End Sub
__________________________________________________ Tag: How to delete from first page to start of the next section break Tag: 58041
Project locked
Hello
I have a doc with a few macros.
Suddenly, without any warning, it has gone and locked itself (it must have
been me as I was mucking around with auto macros)
Anyway, when I try to open it in VBA, there is a 'project locked' window.
I'm adamant that whatever I did, it wasn't to type in a password as I wasn't
looking at this aspect.
Furthermore, when I try to open it, Word doesn't ask me for a password as it
should do if I had really given it a password.
How to I get it open again or am I screwed?!?!?!
Thanks Tag: How to delete from first page to start of the next section break Tag: 58040
Online Printers
I utilize a VBA macro to automate the printing of various documents to
a variety of different printers. Occasionally, the macro will hang if
the intended printer isn't available online at the time, either
because it is turned off, the computer to which it's attached is
turned off or because the computer from which I am printing isn't
attached to the network. Is it possible, using VBA, to check whether
or not a specific printer is online and in working order? Furthermore,
if it isn't, is it possible to "pause" the printer and print, in
effect, to a queue that can be resumed later when everything is up and
in working order? Thanks. Tag: How to delete from first page to start of the next section break Tag: 58028
How to return the name from selected shape
Hi
Does anybody know how to return the name or index number from a selected
shape in Word.
I thought it should be something like this:
msgbox Activedocument.Shapes(ActiveShape).name
but it is not working
/Finn Tag: How to delete from first page to start of the next section break Tag: 58019
using a macro to format currency and dates in a table cell
Hi,
I've been pondering this one for days now. I have text in a table cell that
I always have to select and bold. There are 3 dollar values and one date
that need to be formatted to bold. The date also needs to be changed from
##/##/#### to a full date format. Below is a sample of how the text looks in
the table cell. It is imported from an access database and can't be
formatted prior to being imported into the word document.
This box contains $4.00 three dollars amounts $457.00 and one date that need
changing $9990.85 in some way.
I've tried using Mid, FormatCurrency, Int and a few other VBA functions and
commands, but the closest I got was to bold one dollar figure with no control
over the size of the figure (it bolded 2 letters to the left of the dollar) -
then I forgot what I had done after trying other methods!
It's just a bit beyond my VBA skills to write it. Can anyone help? Tag: How to delete from first page to start of the next section break Tag: 58016
Document Variable Question
Word 2000
I'm working on some macros that use document variables. I wrote one test
macro that shows me the name and value of each document variable. When I
run this test macro, I see the following document variable information:
Name =Sign
Value = ?
My code does not create this document variable (I searched my code for
"Sign" and that string does not appear anywhere in any of my code modules).
If I delete this document variable (using a test routine I wrote for that
purpose), it gets recreated. So I assume that Word is creating this
document variable. Out of curiosity, can anyone tell me why?
-- Tom
State of Montana
Department of Justice Help Desk
"Making the world a safer place." Tag: How to delete from first page to start of the next section break Tag: 58015
dao.record set
Have 3 pc's with windows xp pro & office xp on all. One day one of the pc's
error on a word macro @ this line: "rstproj as dao.record set". Tried
redoing the libraries but no banana :-(. Reinstalled office xp still no
banana. Used to work & still works on one of the pc's. Anyone got any ideas?
TIA Tag: How to delete from first page to start of the next section break Tag: 58014
Ppen blank Word doc from C# based on a custom teplate.[ Word 2003,
Hi! I need to open a blank Word 2003 document from a C# executable.
The document must be based on a custom developed template using Visual
Studio Tools for Office (also C#).
I am having difficulty getting started. I am trying to reference Office
assemblies in my C# app but can not find where they are. I performed complete
installation of Office on my PC.
Also, how do I open the doc and assign a different template than Normal?
Is there a way to open a blank Word document in such a way that new version
of Office do not break my application? For instance, if I reference Word
2003, when Word 2006 comes up, is my app going to break ?
Any ideas/suggestions/urls/code samples are greatly appreciated. Tag: How to delete from first page to start of the next section break Tag: 58013
Using custom dialgo boxes
I am running Word 2000 and am trying to design a document
that combines different paragraphs depending on different
choices and inputs by the user. To do that I'm trying to
create a custom dialog box that has text boxes and
different option boxes. I have been able to create the
custom dialog box as well as a macro that shows the
dialog box.
However, I can't figure out how to pass information that
the user inputs in the text boxes on the custom dialog
box to the macro that complies the document. Can anyone
help me? Tag: How to delete from first page to start of the next section break Tag: 58008
formatting text box if users input numbers
I created a user form that collects data.
There is a text box in which users can enter in text or numbers.
If the user enters in numbers is there VBA code that will make the entered
numbers show up in a specific format Ie: #,##0.00
Thanks Tag: How to delete from first page to start of the next section break Tag: 58005
Using Bookmarks for SaveAs File Name
RE: Word 2003
Iâ??ve created several bookmarks for my Word UserForm. When I create a new
document based on my template, my dialog box opens asks for patientName,
PatientID, clinicDate. On command it fills in the corresponding bookmarks
correctly.
I want to use these same fields such that on saving the document it uses
these 3 same fields (concatenated) as the file name to be stored at a remote
site. (The remote site remains constant and is located on the Save As dialog
box.)
I would like to do this as a macro and assign it to a key-combination. I
donâ??t know how to place these bookmark values into the file name box of the
Save As dialog box. (Name, ID, and Date change with each file.)
Related Question: I know itâ??s bad practice but I would like to encrypt the
file just before saving it using the macro. The macro for this works fine,
but the template obviously exposes the encryption password. Can I encrypt
the template?
Thank you,
Phil Tag: How to delete from first page to start of the next section break Tag: 58001
Footer Page Numbers continued....
Hi Harold
Many thanks for the restartnumbering=false tip. I have
entered the extra
command line in to my procedure but keep getting the
following error
Run time error 91 - object variable or with block
variable not set
please see my code below - have I just put the command in
the wrong place?? many thanks.
----------
Sub InsLscPgA3()
'Insert a Landscape Page
'On Error GoTo EndLine
Selection.InsertBreak Type:=wdSectionBreakNextPage
With Selection.PageSetup
.PaperSize = wdPaperA3
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(1.25)
.BottomMargin = InchesToPoints(1.25)
.LeftMargin = InchesToPoints(1)
.RightMargin = InchesToPoints(2.5)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.49)
.FooterDistance = InchesToPoints(0.49)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
Selection.HeaderFooter.PageNumbers.RestartNumberingAtSecti
on = False
Exit Sub
EndLine:
MsgBox "Your printer will not allow A3 pages - change
your default print settings"
End Sub Tag: How to delete from first page to start of the next section break Tag: 57996
Word 2003. Opens file /runs macro. How do I prevent dialog boxe.
We are using a PeopleSoft feature, that supposed to open a document, run a VB
macro and create a new file and shut Word. It opens the file, and runs the
macro. Then it starts asking questions via a dialogue box. So that
completely stops the process. Is there anyway to shut off those dialogue
boxes. Just take the defaults and keep runing. Once this process stops, it
hangs any future processes because someone has to go to the server and hit
enter a few times to clear out the questions. I can't find any switch or
setting to get us around this. Tag: How to delete from first page to start of the next section break Tag: 57994
Table Borders
Is there a way to not print the table borders in a
document - I have 200 documents using tables to lay the
document out efficiently but unfortunately didn't remove
the borders before creating them (they were created
initially using a mail merge).
To save having to remove the borders from all the files
can I just have a print event?
This is the one I have tried but it doesn't work and it
is only set to work on the first table in a document
anyway, I will have many tables- can anyone help please??
Thank you.
Gail
Private Sub appWord_DocumentBeforePrint(ByVal Doc As
Document, Cancel As Boolean)
Set myTable = ActiveDocument.Tables(1)
With myTable.Borders
.InsideLineStyle = wdLineStyleNone
.OutsideLineStyle = wdLineStyleNone
End With
End Sub Tag: How to delete from first page to start of the next section break Tag: 57983
is it possible to make textboxes
No VBA expreience, just trying to research. I have an idea for an app I'd
like to build inWord, and part of the way it would work is to build one or
many text boxes. Don't know if that's terminology, but I am talking about
the white thing at the bottom of Word (when you have selected Drawing
tools), and this white thing has the letter A in it. Word refers to it as a
Text Box, anyway.
So is there a way to do this where it will build a number of text boxes,
allow me to specify a border, and then populate the text boxes with content
based on the choices the user makes in a form? Tag: How to delete from first page to start of the next section break Tag: 57980
protecting document - word'97
Hi all,
I am writing a VB application for Word 97. The application merges several
prewritten Word documents based on the user selection. For example, if the
user selects to generate certain type of document in the application, I
would like to generate a new document at runtime by merging DoumentA.doc ,
DocumentB.doc and DocumentC and display it to the user. I can do this
without any problem. But now I need to password protect the contents coming
from the DocumentC.doc in the new document. How can I do this?
Thanks.
-Nikhil Tag: How to delete from first page to start of the next section break Tag: 57979
macros repeat command print selected pages in 2000 page file?
I'm trying to print selected pages in a 2000 page file. I've set up the macro
and it works on a single instance basis but I need a command to insert at the
end of the Macro to tell it to search for the next qualifier and repeat to
end.
Thanks Tag: How to delete from first page to start of the next section break Tag: 57978
Word inside IE
1) I have a web site that prepares a word doc for a user
2) The user uses IE to open the word doc (Clicks on the filename.doc)
3) My autoopencode in a macro preloads some data from the web site into doc
4) The user cleans up the doc and adds lots more date
5) Clicking on a button saves the doc to the c drive of the user and uploads
it to the web site
The question is, can I get the user to exit, that is move on to the next web
page, using Word ocde?? I can't figure out how to tell IE anything from
within Word, even though Word is contained in IE.
I can msgbox the user to tell them to use the back button, but that then
asks them to save the word doc (it's already saved), and it gets them to the
wrong web page.
Ideas?? Tag: How to delete from first page to start of the next section break Tag: 57977
Exporting modules
Hi,
I have exported some modules and forms (*.bas, *.frm, and
*.frx) from a project. Can I call these files from within
a project?
/ Ulf Tag: How to delete from first page to start of the next section break Tag: 57976
Bring to Front?
How can I bring a word document to the front of the display? At present, my
documents are all in the background (invisible). When I've finished with
automation, I want to bring one to the front (on top). Any ideas?
Thanks. Tag: How to delete from first page to start of the next section break Tag: 57975
Hi There,
Would you please let me know how to delete from first page until the first
section Break (Next page) in VBA?
Any help would be great.
Thanks,
Re: How to delete from first page to start of the next section break by Helmut
Helmut
Wed Oct 20 08:07:14 CDT 2004
Hi Leila,
first page included or not?
Here is an example, which includes the first page.
---
Dim rDcm As Range
Dim iSct As Integer
Set rDcm = ActiveDocument.Range
For iSct = 1 To rDcm.Sections.Count
If rDcm.Sections(iSct).PageSetup.SectionStart _
= wdSectionNewPage Then
rDcm.End = rDcm.Sections(iSct).Range.start
Exit For
End If
Next
rDcm.Select ' for testing only
rDcm.Delete
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Re: How to delete from first page to start of the next section bre by Leila
Leila
Wed Oct 20 13:55:04 CDT 2004
Thank you Helmut, your solution worked great.
"Helmut Weber" wrote:
> Hi Leila,
> first page included or not?
> Here is an example, which includes the first page.
> ---
> Dim rDcm As Range
> Dim iSct As Integer
> Set rDcm = ActiveDocument.Range
> For iSct = 1 To rDcm.Sections.Count
> If rDcm.Sections(iSct).PageSetup.SectionStart _
> = wdSectionNewPage Then
> rDcm.End = rDcm.Sections(iSct).Range.start
> Exit For
> End If
> Next
> rDcm.Select ' for testing only
> rDcm.Delete
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
>
>
Re: How to delete from first page to start of the next section bre by Helmut
Helmut
Wed Oct 20 14:12:09 CDT 2004
Hi Leila,
oops, beware !
working only if there is a section with
PageSetup.SectionStart = wdSectionNewPage
Put rDcm.Delete in the if-command, please.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98 http://word.mvps.org/
Re: How to delete from first page to start of the next section bre by Leila
Leila
Wed Oct 20 16:39:04 CDT 2004
I did, thanks for the notice though :)
"Helmut Weber" wrote:
> Hi Leila,
> oops, beware !
> working only if there is a section with
> PageSetup.SectionStart = wdSectionNewPage
> Put rDcm.Delete in the if-command, please.
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
> http://word.mvps.org/
>