Advanced Techniques
The total number of documents currently open
Application.Documents.Count
Current version of Word
Application.Version
Current build of Word
Application.Build
StyleAreaWidth ??
Getting the Position of the cursor
x = Selection.Information(wdInformation.wdHorizontalPositionRelativeToPage)
y = Selection.Information(wdInformation.wdVerticalPositionRelativeToPage)
72pts = 1 inch = 2.54cm
This only works when you are in Page view.
If you are in Normal view it returns the distance from the top margin.
Always set the view to Page view and the magnificationt o 100% before using the Information proeprty to get the cursor position.
Switch to Print Preview
This changes the view to print preview
Application.PrintPreview = True
Define the size of the window on the screen
With Application
.WindowState = wdWindowStateNormal
.Height = 400
.Width = 300
End With
Check the File Exists before opening
With Application.FileSearch
.FileName = "document.doc"
.Lookin = "C:\Temp\"
.Execute
If .FoundFiles.Count > 1 Then
'file exists so it can be opened
End If
End Sub
Is there a document currently open ?
If (Documents.Count >= 1) Then
'a document is currently open
Else
'no document are open
End If
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev