View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Bring Word 2003 to the front.

Without seeing your code it is difficult to see what it is doing.
However you should call the document you want to activate eg

Dim dSource As Document, dTarget As Document
Dim sFname as String

sFname = "C:\Path\Docname.doc"
Set dSource = ActiveDocument
Set dTarget = Documents.Open(sFname)
'Do your stuff
dSource.Activate


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Skeddy wrote:
Graham,

Thanks for the print preview idea, that is better as I now dont get
the document sent to printer dialog. I have to use thsi as some of
the fields are in the header and footer.

Unfortunately the problem of the document being snt to the back
persists. As soon as the macro ends XP, or Word puts the document
behind the last window opened.

Is there any way around this ?

Regards,

Skeddy.

"Graham Mayor" wrote:

If these are form fields, then provided they are not in the
header/footer you can update them from doc properties by checking
the calculate on exit check box of one of the fields. They will
update when you tab out of the field.
If this is not a protected form and you want to update docproperty
fields then you can use the update macro used as an example at
http://www.gmayor.com/installing_macro.htm
If you want to update the fields by 'printing' then

ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview

will have the same effect.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Skeddy wrote:
I hope somebody can help me.

I have a document with field cods in it which are linked to the
document properties.

In the document I have put a macro which opens up the document
properties dialogue box to let you input the information, the fools
it into updating all of the field codes by printing page 0. Not
elegant I know but I couldn't find a command to update all of the
field codes.

The code is:

Application.Dialogs(750).Show

Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages,
Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="0",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=False,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0,
PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0

The only problem is that once the macro has run, whether it is from
within the document or from a button on the toolbar, XP will send
the document down to the taskbar if it perceives that another open
application has priority, or was open first.

Is there a way around this ? I have tried everything I can think of
i.e "ActiveDocument.Activate", "ActiveDocument.BringToFront = True"
but nothing seems to work.

I hope somebody can help as it is driving me mad.

Thanks.

Skeddy.