"On Error Exit Do" is compile error??
I created a Do Loop, then made my first statement after Do to be "On Error
Exit Do". But it highlights in red and gives me a compile error: "Expected:
GoTo or Resume". What did I do wrong? How do I do it right?
Ed Tag: Las record inserted in DAO Tag: 59115
Inserting Pictures--default display
I want to insert a picture from a particular folder. The folder is not the
'default' folder where Word apparently thinks my pictures are stored.
Here is the code I am currently using:
--------
ChDir "C:\other picture files"
With Dialogs(wdDialogInsertPicture)
.name = "*.jpg"
.Show
End With
--------
No matter the variations on the above, the initial dialog is my default
pictures folder (currently set to "C:\Clip Art"). How can I get the "C:\other
picture files" location to initially display in this routine.
Thanks,
Ed
P.S. When I run 'CurDir' within the "With" routine, it displays properly as
"C:\other picture files" Tag: Las record inserted in DAO Tag: 59112
How to ignore autosave bug?
Hi, why DocumentBeforeSave raised on Word autosave operation?
Can I detect when autosave raised DocumentBeforeSave?
Thank you. Tag: Las record inserted in DAO Tag: 59111
DDERequest Items...
Hi.
I would to have the bookmarks into a word document through a dde request.
Finding in internet i found only three items "SysItems","Topics","Formats".
There is an item that return me the bookmarks?
Thanks
--
by \ \/ /\/
PerezDeQueya80 on AzzurraNET.org Tag: Las record inserted in DAO Tag: 59109
normal open as an add-in program
Every time I open Word and/or Outlook (office XP) I get a message that says
"The global template, NORMAL.DOT, is already open as an add-in program." How
do I shut that off?
Also every time I close the same, I get prompted to save two of the
templates that I use on a regular basis, even if I do not make changes to
them. I would like to shut that off too.
I know that in the tools, options menu you can turn on or off the option of
"prompt to save normal template." That option is off.
Please help me solve this annoying problem. Tag: Las record inserted in DAO Tag: 59098
Auto fill one field from a previous filed
We have a document that our office uses to send information about a patient
to insurance companys, I have pasted a paragraph below. When our users type
patient name the first time, I want it to fill in the patients name field
below. Can someone tell if this can be done and if so how I could do it(and
save it as a template for the users)
Thanks for any help offered.
Ken
<date>
<Physician name>
<physician address>
<city, state, zip>
re: <patient name>
<patient social security>
Dear Dr. <Physician Name>:
Enclosed please find the results of <Patient's name>'s
polysomnography. In accordance with the terms of our AASM accreditation we
need a copy of the patient's follow up consultation with you to complete
<his/her> file. Tag: Las record inserted in DAO Tag: 59096
macros and autotext from a non normal.dot tamplate
Hello,
I'm trying to write a macro that inserts an autotext entry
from a template other than the Normal.dot.
In the code, NormalTemplate.AutoTextEntries("cbo").Insert
Where:=Selection.Range, _RichText:=True
when I try to replace Normal with the name of my global
template where the "cbo" autotext is found, I get an error
message.
In a macro,how can I tell Word to look on any other
template, or on all active templates to find autotexts?
Much appreciation!
Kurt Tag: Las record inserted in DAO Tag: 59095
Outlook and Word integration
Hello,
In Word, I have created an macro with a dialog box which
allows a user to call up an outlook contact. Is there a
way to write code which selects specific fields from the
Outlook contact to bring up in Word? i.e. Address,
business telephone number, etc.?
Much appreciation,
Kurt Tag: Las record inserted in DAO Tag: 59094
Att: Helmet. Search changes font size.
Hi
I asked a question last week and I have since managed to tidy up my macros
as I was no longer sure whether the macros assigned to 'new macros' or 'this
document' or referenced to the .dot was the macro which was running when I
clicked on my tool bar.
So I can now say with certainty that the macro below is the 'guilty' macro.
When searching for words, it changes the font size which might be
16, 14, 12, 10 , for a four lettered word (falling tone) to 12,12,12,12,
(normal font size which I happen use for flat tones).
This possibly didn't show up in my question if you don't allow .html.
Any ideas which line could be doing this?
Thanks
Sub Highlight()
Dim sSrc As String
Options.DefaultHighlightColorIndex = wdYellow
sSrc = Selection.Text
Resetsearch
Selection.SelectColumn
With Selection.Find
.Text = sSrc
.Replacement.Text = sSrc
.Replacement.Highlight = True
.MatchWholeWord = True ' or true if you like
.Wrap = wdFindStop ' !!!
.Execute Replace:=wdReplaceAll
End With
Resetsearch
End Sub
Sub Resetsearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub Tag: Las record inserted in DAO Tag: 59093
Sections: Index and Count
Can anyone help with the following, please?
I have a document with a large number of sections. My cursor will be
in the footer of a randomly selected section from which I need to step
forward through each one checking a sequence until the last section is
reached.
In the normal course of events I might use an "On error..." statement
which would occur when arriving at the last section and my code asks
for another one. I would exit from the routine at this point as the
error would be trapped.
However, in this instance, when I arrive at the last section whilst
still in the footers and update my sequence the cursor flips back to
the previous section. The code continues to ask for the next section
and therefore a loop is generated.
I know how to determine the number of sections in a document and also
know how to go to the last one as well as stepping through each
section.
But how can I find out when I've arrived at the last section after
each step through? Is there a way of comparing the index of the
section the cursor is located against the total number of sections?
Regards
Roderick O'Regan Tag: Las record inserted in DAO Tag: 59089
Word Macros: Drawing Objects?
Hi all,
tried recording a macro of adding/modifying drawing objects.
The macro recorder simply failed to record anything, and in fact, prevented
me from performing many operations.
What the heck!
Excel does an excellent job of same.
Q: Are drawing objects even supported by Word VBA?
Specific issue: I need to add and change the text in a text box, as well as
paste/move an object.
Any help appreciated!
Regards...
SMS Tag: Las record inserted in DAO Tag: 59088
Text enrichment
Are you familiar with any product or feature that can
enrich the text and wording of an existing word document ?
I mean not only spell or grammer check but a tool that
can make the document look more proffesional.
Thanks in advance,
Erez Tag: Las record inserted in DAO Tag: 59085
Bold formatting
Hi,
I would like to format text to bold which comes in between two special
characters, say all the text between # and * as in below .
word document formatting # is easy if you know * macro coding.
Please provide me a code snippet for this as I'm new to VBA code.
Thanks in advance.
Sajja Tag: Las record inserted in DAO Tag: 59083
Run once macro
Hello NG,
I have a macro that is associated with a check box from the "forms" tools,
and if it is clicked then the "Run macro on Entry" of the check box.
If someone changes their mind and deselects chbox and then selects it again
the macro runs again.
How can I get the macro to only run once.
I've tried to create a flag and set it to 1 if the macro has already run,
but that doesn't seem to work for me,
any suggestions.
James
'Code begins here============
Private Sub Document_Open()
Dim wdFlag As Integer
wdFlag = 0
End Sub
Sub Color()
'
' Color Macro
' Created: Nov. 9th 2004
' Author: James
' Purpose: Informs customer of printer purchase options
'
If wdFlag = 0 Then
Selection.EndKey Unit:=wdStory
Selection.Font.Color = wdColorDarkBlue
Selection.TypeText Text:= _
"We can help you purchase an inkjet printer at a substantial "
Selection.TypeText Text:="discount!" & Chr(11) & _
"Please call Liz at 555-1234 for more information!"
wdFlag = 1
Else
Exit Sub
End If
End Sub
'Code ends here=========== Tag: Las record inserted in DAO Tag: 59082
Indexing
I tried a post the other day and I'm not sure if its
working, if you get this please email me at
topdev@goodnets.com.
HOw can I comprehensively index a word document?
I'd like to show which words appear on which pages.
I looked up indexing in help and it seems all manual.
I made a program to iterate through the object model and
it can give me the word count and the word but I cant
relate this to page number of paragraph number in word
plus its really slow for a large document.
thanks alot and if there is a better newsgroup or resource
to refer to please let me know.
thanks again. Tag: Las record inserted in DAO Tag: 59079
my word screen keeps clicking off
when i have my word document up and i'm typing about every 45-60 seconds the
screen clicks off. By that i mean as i'm typing it is like clicking on the
tool bar (in a blank spot) and the top bar that is usually dark blue goes to
a light blue which means that even though you have that screen up it isn't
able to type anything in...is there some sort of timer on this program? Tag: Las record inserted in DAO Tag: 59078
Automation Between Outlook 2003 and Word 2000
We used to have Outlook 2000 with Word 2000 and I used the automation code
below which worked fine. We then migrated to Outlook 2003 with Word 2000 and
the same piece of code does not work. What am I missing? Pls help. See code
below:
Dim myOutlook As Object
Dim myInspector As Object
On Error Resume Next
Set myOutlook = GetObject(, "Outlook.Application")
If myOutlook Is Nothing Then
Set myOutlook = CreateObject("Outlook.Application")
End If
On Error GoTo 0
If myOutlook Is Nothing Then
MsgBox "Application Not Available"
End If
Set myInspector = myOutlook.ActiveInspector
myInspector.Activate
MsgBox myInspector.CurrentItem.Subject, vbInformation
Set myOutlook = Nothing Tag: Las record inserted in DAO Tag: 59074
Spellcheck Locked Word Form
Word 2003: I assist in designing custom forms (using the FORMS Toolbar) for
my company. I Recently ran into a snag...To preserve the intergrity of our
fomrs, all forms are locked prior distribution. However, with the document
locked the users no longer have the option to run SpellCheck. Any
suggestions? Tag: Las record inserted in DAO Tag: 59071
FormFields().Result - hidden text
Good day all,
I have the following Word 2000 VBA code:
txtTemp = ActiveDocument.FormFields("myField").Result
However, I'm having trouble with the statement returning a
".Result" if the FormField is Font Formatted as "Hidden" text.
The following statement has no trouble setting the "myField"
value, even when it is Font Formatted as "Hidden" text.
ActiveDocument.FormFields("myField").Result = 1234.56
Is this a VBA "feature"?
Is there a work-around?
Thanks in advance,
Graig Tag: Las record inserted in DAO Tag: 59066
Using Hyperlinks in Protected Forms
I have followed the FAQ
(http://word.mvps.org/FAQs/TblsFldsFms/HLinksInFormsContent.htm) to the
letter, and I can't get hyperlinks in protected forms to work properly.
I have several hyperlinks pointing to bookmarks within the same Word XP
document. This is a form that the user fills out; the hyperlinks take them
to a spot in the document which explains the section of the form they're in.
But after I've created the macro, added the macrobutton to the hyperlink
field, and protected the form, when I double-click on the hyperlink/button,
the location jumps to the very next text field in the document, nowhere near
the intended bookmark. All of my descriptions have been bookmarked, and the
hyperlinks are pointing to the bookmarks as necessary.
Will this trick work with internal hyperlinks? Or is it really only intended
for external weblinks?
I would appreciate any advice or guidance.
Thanks,
Beck Tag: Las record inserted in DAO Tag: 59065
Is there a style sheet for Word when a Word document is opened in
Hi! I'd like to know if there exists a technology to change an appearance of
a Word document when the document is opened in IE browser? In other words, if
I open an existing document in IE, can I change the document style on the
client?
Many Thanks for your help, Tag: Las record inserted in DAO Tag: 59064
Problems With Reference to Addin
Hi Folks,
I'm having trouble with a Template which sets a reference to an addin using
MyTemplate.ThisDocument.VBProject.References.AddFromFile strRef.
If the document needs to move to another environment which has a different
setup to the originating env it can use a Wizard, which opens the document,
adds the addin appropriate to that env using "AddIns.Add
FileName:=strTemplate(1), Install:=True".
But something somewhere goes wrong and when i check my references it says
Missing and points to a temp file : C:\Documents and Settings\User\Local
Settings\Temp\3\WRL????.???
**This is in the wizard to open the doc**
Set MyDialog = Dialogs(wdDialogFileOpen)
MyDialog.Format = wdFormatDocument
If MyDialog.Display <> -1 Then GoTo ErrOpen
MyDialog.Execute
ActiveDocument.AttachedTemplate = ""
End If
Can anyone help me with this?
Cheers
J Tag: Las record inserted in DAO Tag: 59063
How to make simple XSL transforms for Word content?
I would like to be able to apply XSL transforms to Word XML content that
would allow me to open the same content in multiple Word templates with
different designs (i.e. different header and footer for same main content.) Tag: Las record inserted in DAO Tag: 59057
Link to PDF file using VBA?
It is possible to link Word to an Excel spreadsheet via VBA command similar to
this:
Selection.InlineShapes.AddOLEObject ClassType:="Excel.Sheet", filename:= _
"C:\excel\datasheet.xls", linktofile:=True, DisplayAsIcon:=False
Is a similar (or dissimilar, but functional) link to a .pdf file possible? I
just want the 'image' of the file, not ability to edit, etc..
Thanks.
Roy Tag: Las record inserted in DAO Tag: 59053
automatically update file name in header when saving as a differe.
I work for the local council and have been asked to create a template (to be
used by many different inexperienced users) where the filename in the header
needs to be automatically updated when saving under a few filename (without
using f9 or macros) - the other users are at a very basic level and would not
be happy with having to press extra buttons or go into the header area.
I have tried putting in IF field codes, which do work, but you still have to
go into the header and press F9
PLEASE!!! Can someone help??Thanks. Tag: Las record inserted in DAO Tag: 59050
Font size is changed when runnning search
Hi
I have words in a table which reflect the tones of a foreign language
eg thee (falling tone)
But this special format is changed and becomes
thee (flat tone)
when I do a word search using the following two macros.
As I can't see a line for font, I wonder which line is causing the font size
to change and can I take it out without any other side effects.
Thanks in advance
Sub Highlight()
Dim sSrc As String
Options.DefaultHighlightColorIndex = wdYellow
sSrc = Selection.Text
Resetsearch
Selection.SelectColumn
With Selection.Find
.Text = sSrc
.Replacement.Text = sSrc
.Replacement.Highlight = True
.MatchWholeWord = False ' or true if you like
.Wrap = wdFindStop ' !!!
.Execute Replace:=wdReplaceAll
End With
Resetsearch
End Sub
Sub Resetsearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub Tag: Las record inserted in DAO Tag: 59048
Hide fields
Hi,
I know how to hide all shapes in a document before
printing:
With ActiveDocument
iNum = 1
Do Until iNum = .Shapes.Count + 1
.Shapes(iNum).Visible = msoFalse
iNum = iNum + 1
Loop
iNum = 1
End With
But if I try to use the same method to hide all fields in
the document, there is no such thing as:
.Fields(iNum). Visible = msoFalse
The field I want to hide is:
{ MACROBUTTON NoMacro [Click here to type your text] }
and I don't think is nice to show that field on the print
out.
Any clue would be very appreciated.
/ Ulf Tag: Las record inserted in DAO Tag: 59047
Change date in header
Hello All,
I am using wind XP and office 11. I want to replace the date field in header.
The date field is autodated, and I want to replace it with last modDate.
I can replace the autodate in the document body. but I couldn't do it in the
header.
Can anybody help?
Thanks
Karen Tag: Las record inserted in DAO Tag: 59042
Mouse Move to close user form Causes Automation Error
Mouse Move Causes Automation Error
I want to use mouse move to close a second form (hide or unload)
It works fine until I make it a .dot in the startup folder, then I get an
Automation error.
I've tried several things, including using 'on error resume', but can not get
it to work as a .dot in Start Up.
Any suggestions would be appreciated.
TIA Tag: Las record inserted in DAO Tag: 59034
Date picker for Word 2002?
Does anybody have some VB code they're willing to share with me so I can
install a date picker in a Word 2002 document? Tag: Las record inserted in DAO Tag: 59033
How do I create a macro to submit a document in e-mail?
I would like to use a macro to submit a document in e-mail. The macro would
save a completed MS Word fill-in form to the local users desktop, launch a
new e-mail message, and insert the saved document into the new massage. From
there the user could fill in the subject line, add any desired text in the
body and send to the desired recipient. I would like to be able to run this
macro within Word by clicking a "Submit" button at the end of the form. Can
anyone help me out? Tag: Las record inserted in DAO Tag: 59032
Run word docs on their own window
Does anyone know how to change the setting so word doc can be open in their
own windows? Tag: Las record inserted in DAO Tag: 59031
Intercept {Enter} key in VBA
I have written a routine "InsertPageBreak" that checks the Selection range
to ensure that no bookmarks will be split by insertion of the page break.
I would like to do the same for whenever the {Enter} key is pressed to
start a new paragraph, but I can't find a Word command that is initiated
by the {Enter} keystroke.
All help is greatly appreciated.
--
Tim Shaffer Tag: Las record inserted in DAO Tag: 59030
some of my fonts(letter) becoming signs&symbols ! WHY?
A friend installed , yesterday ,on my computer (window xp home sp2) Lavasoft
Ad-Aware 6 & PestPatrol , so that I will be able " to get rid " off all the
SpyWare & Ad-Aware "programms" that was installed in my computer ; not long
after , as he was "deleting" some of these Spyware & Ad-Aware my FONTS
(letter)started tO "VANISH / TURN to (become) " SIGNS & GEOMETRICAL SYMBOLS (
at first I thought that it was "chinese" ) . Everything on myDesktop & in the
START menu ,control panel , EVERWHERE in WINDOW XP ALL THE TITLED SENTENCES
/ TITLES GOT AFFECTED ... I REBOOTED , BUT IT WAS STILL ALL SIGNS & GEO.
FIGURES ....WHY .??? WAS SOMETHINGS " IMPORTANT" DELETED ..?? AND IF SO I
COULD I GET BACK MY "FONTS / LETTERS" BACK ..???? THANK YOU . Tag: Las record inserted in DAO Tag: 59029
Word in browser, formatting question
Hi! I generate a report in a jsp page and change the ContentType on the page
to
application/msword. The document opens up in a Word in IE. However, when the
document is opened, it's loosing some formatting and when the users try to
save it, it gives a warning that some formatting is going to be lost.
My question is: Can I change formatting and appearance of the document on
the client without programming against the Word object model ? What else can
I do to satisfy the requirement that the users should be able to save it to a
.doc format?
Many Thanks in Advance, Tag: Las record inserted in DAO Tag: 59027
autotextlist field control
hi,
how can i get the click_event fired when i right click mousebutton within a
autotextlist field ,not using vba or macro,but only VB programming? Tag: Las record inserted in DAO Tag: 59021
Changing Paragarphs in a Range
I am interested in defining a range of paragraphs in the main story of a
document based upon a selection and then chaging the first few characters in
each paragraph in that range. When I try to update a paragraph using a "for
each" loop the range is redefined apparently due to the change and I canonot
effect a change in more than one selected paragraph. Tag: Las record inserted in DAO Tag: 59013
FileSearch Object not working
I have a macro which uses a Shell FTP to retrieve a file from UNIX to Windows
to be used as a data source for a mail merge (just acomma deleimited test
file). At one site which is running Windows XP and Word 2002 I'm having
problems with the FileSearch object not finding the file after the successful
Transfer of the file.
First the user was getting a runtime error #70 Permission Denied and after
checking with the site's IT dept. and being assured that the user has Full
rights to the network directories where the action is taking place, the error
continued. I then commented out a KILL command which got rid of the
premissions error (it deletes the script I created to be used in the FTP),
but after that the macro does a file search to be sure that the file is
really there and it always fails, even though I can see the file in the
directory.
The code is:
'***** Delete file with userinformation
Kill (DownloadPath & "Ftpget.txt")
'***** Check if file is present after download
Set objFSO = Application.FileSearch
With objFSO
.LookIn = DownloadPath '***Path to where file is
.FileName = FileToGet '**Name of file
.MatchTextExactly = True
If Not .Execute > 0 Then
'***** File doesn't exists, display error message!
ElseIf FileLen(DownloadPath & FileToGet) < 10 Then
'***** File does infact exists, now check if it is more then 0 bytes =)
error message2
Else
'***** File download succesfull
End If
End With
Set objFSO = Nothing
The user always recieves the first error message. I've check the references
and they are all the same. This code works at other sites. Is there
something that was not installed on this user's machine? Can anybody help?
I'm out of ideas.
Thanks,
Steve Tag: Las record inserted in DAO Tag: 59005
HT mine data from Word to SQL Server
I need to be able to somehow mark parts of an existing
Word document, pull the marked data from the document and
map it into a table in SQL. I have seen information on
how to do it from Excel, but not for Word. Can you point
me in the right direction? Tag: Las record inserted in DAO Tag: 58996
Changing numbers
** This is a re-posting of the question asked on word.vba.beginners on 9
November. I'm reposting it here due to a paucity of responses to my first
post! **
We sometimes get documents where paragraph numbering needs changing
and for one reason or another we cannot use automatic paragraph
numbering in the document, just manual numbering. I am trying to
write a macro that will enable you to renumber basic paragraphs in a
document (nothing fancy, just ones numbered 1, 2, 3, 4 etc).
I am using the Selection.Find method to search for the first number,
then I want to replace it with another (incremented) number, search
for the next number, replace that, and so on till the end of the
document. I cannot get this to work. If finds the first number and
replaces it but then stops. Here's the code I've got so far, and I
daresay I'm going about it the wrong way.
Sub ReplaceNos()
Dim a As Integer
Number = 1
Selection.Find.ClearFormatting
With Selection.Find
.Text = Number
.Forward = True
.Wrap = wdStop
.Format = False
Do While .Execute
if Selection.Information(wdHorizontalPositionRelativeToTextBoundary)/72<2
then
Number = Number + 1
a = Selection.Text
a = a + 5
Selection.Text = a
Selection.Collapse Direction:=wdCollapseEnd
End if
Loop
End With
End Sub
This *should* search for the digit 1 and, if it is within the first 2
inches of the left margin, replace it with 6. Then search for "2",
replace it with 7, etc etc.
Silly question... why does it not work? I really need a lot more
knowledge of how the selection.find method works, I think!
Steve Wylie Tag: Las record inserted in DAO Tag: 58994
Word templates over a WAN
I have a client that has an interesting problem.
The IT department wants control over templates that are installed on their
corporate intranet. The network is broken up into several LANs operating at
100Mbs that are interconnected using a WAN at 7Mbs. They also have users
that connect to the intranet using either dialup/broadband using a VPN. All
templates are stored on their central server and they have the path to the
templates set for each individual user using the Workgroup templates.
A user that creates/uses a document that uses the template from the LAN
experiences a 2 to 3 second delay. This user A saves the document and sends
to user B that is on a different segment of the WAN. When user B opens the
document then the open will take 20 to 30 seconds to complete. Each of the
templates is running some VBA. Some users experience wait times of upto 20
minutes when opening a document.
My guess is that when the document is opened by user B it is trying to
reference the template that is on user A's segment of the WAN.
I have the following recommendations for the client:
1) Replicate the servers for each of the segments such that the template is
resolved to the local LAN.
2) Deploy the templates to each and every client machine on their network.
Provide an installer that each user will use to install on each individual
system.
Any thoughts or comments? Tag: Las record inserted in DAO Tag: 58993
error when changing a paragraph style
My document has a paragraph style named "myData." When I select one
paragraph and run this subroutine:
For Each para In Selection.Paragraphs
para.Style = myData
Next para
I get the following error message:
"One of the values passed to this method or property is out of range,"
and the line:
para.Style = myData
is highlighted.
What am I doing wrong? Tag: Las record inserted in DAO Tag: 58992
Using outlook contact details
CAN I USE CONTACT INFORMATION IN OUTLOOK CONTACTS TO WRITE LETTERS OR A FAX
IN WORD? Tag: Las record inserted in DAO Tag: 58990
Finding Boot Drive
Is there a function for finding the boot drive from within VBA that
will work will with Word '97 and later for Windows '98 or later?
I have an installer that installs an INI file in the Windows directory
on the user's system, which may or may not be on the C: drive. When my
template opens, I need to read that INI file, but I'm not sure how to
know the drive to use.
Thanks in advance,
gary Tag: Las record inserted in DAO Tag: 58989
Determine if cursor on a graphic
Does anyone know how to programmically determine if the
cursor/current selection resides on ANY type of graphic?
Thanks a bunch. Tag: Las record inserted in DAO Tag: 58988
Tracked changes and outline levels
In code, how do I read a tracked change in Word and know the outline level?
I want the code to find a tracked change, read it, record the outline
number/level, and write a summary of the change.
For example, if paragraph 3.1 of a document had a tracked change that showed
the word "contract" was replaced with "purchase order", I want the code to
write the following: "In paragraph 3.1, replace 'contract' with 'purchase
order'." Tag: Las record inserted in DAO Tag: 58979
Switching Between Printers in a Single Macro
Hello,
I am in a fix. I have a macro that basically needs to perform the following
tasks:
Save a mail merge document to an RTF with a specific name. (So far so good
on this one!)
Print the RTF to a PDF file.
Print the RTF to the printer on LPT1.
Delete the RTF.
Close any remaining open windows.
Most of the macro is working fine. My trouble is switching between the two
printers. No matter what I do, the default printer is being changed to Adobe
PDF. I either need to know how to prevent this or how to switch it back to
the printer on LPT1.
The template, which incorporates this macro, is being distributed to several
different people each with different printers and printer names.
Is there a way to accomplish what I need????
Here is my macro so far ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub OSDFileSaveAsRTF()
'
' OSDFileSaveAsRTF Macro
' Save merged file as an RTF file
'
With ActiveDocument.Bookmarks
strFileName = .Item("OSDNumber").Range.Text
strFileName = strFileName & .Item("BasicForm").Range.Text
End With
ActiveDocument.SaveAs FileName:="c:\osd\" & strFileName & ".rtf", _
fileformat:=wdFormatRTF
'Print saved RTF File to PDF File
With Dialogs(wdDialogFilePrintSetup)
.Printer = "Adobe PDF"
.DoNotSetAsSysDefault = True
.Execute
End With
'ActivePrinter = "Adobe PDF"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
'Set active printer back to printer on LPT1
'ActivePrinter = " on LPT1:"
'Delete RTF File
'ActiveDocument.Close
'Kill "c:\osd\" & strFileName & ".rtf"
'Close remaining active documents
'ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Any help would be greatly appreciated.
Thanks in advance for your assistance.
Regards,
Gilley
aka DilbertIsMyHero Tag: Las record inserted in DAO Tag: 58978
Switching Printers within the same Macro
I have searched and searched for a solution to my problem. I have found bits
and pieces but nothing to tie it all together.
I have a macro which basically does the following:
Saves a merge document to an RTF file.
Prints the saved RTF file to a PDF file.
Prints the saved RTF file to the printer on LPT1.
Closes the active window.
Deletes the RTF file.
Closes remaining open windows.
The problem lies in switching between the Adobe printer and the printer on
LPT1. This template, which contains the macro, will be distributed on
several different computers. Each computer has its own printer with its own
name.
I am saving to the RTF file so that the PDF file is forced to have the same
name in a specific directory.
Below is my macro (such as it is right now)!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub OSDFileSaveAsRTF()
'
' OSDFileSaveAsRTF Macro
' Save merged file as an RTF file
'
With ActiveDocument.Bookmarks
strFileName = .Item("OSDNumber").Range.Text
strFileName = strFileName & .Item("BasicForm").Range.Text
End With
ActiveDocument.SaveAs FileName:="c:\osd\" & strFileName & ".rtf", _
fileformat:=wdFormatRTF
'Print saved RTF File to PDF File
With Dialogs(wdDialogFilePrintSetup)
.Printer = "Adobe PDF"
.DoNotSetAsSysDefault = True
.Execute
End With
'ActivePrinter = "Adobe PDF"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0
'Delete RTF File
ActiveDocument.Close
Kill "c:\osd\" & strFileName & ".rtf"
'Close remaining active documents
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I hope you can make heads or tails from the above since the line breaks are
messed up.
I basically want to make sure at the end of the process that the default
printer is the printer on LPT1 not Adobe PDF. No matter what I do, the
default printer keeps getting switched over.
Any help would be appreciated. And thanks in advance.
Regards,
Gilley
aka DilbertIsMyHero Tag: Las record inserted in DAO Tag: 58976
HI,
how can i read the lastest inserted or edited record with DAO in VB6?