The macro is executed when a document is opened. If the macro is not executed because you open a file with double-click, then you have to change the vba option.The macro must be inserted under GlobalMacros > ThisMacroStorage [image1].
1 2 3 4 5 6 7 8 9
Public Sub GlobalMacroStorage_DocumentOpen(ByVal Doc As Document, ByVal FileName As String) Doc.ActiveWindow.ActiveView.ToFitAllObjects With Doc.MasterPage .Color.RGBAssign 165, 175, 175 End With Exit Sub End Sub
i created a new file.... page background not changed sir
besides fit to window is applying
you link to a post that talks about opening a document. and now you want the macro to work when you create a new document?if you ask for help, then take the time to describe exactly what you need.
Truly i do not know what is in the script. i got it at AI. Been trying any new or opened document should be affected. That's it
This now works when opening or creating a document.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Private Sub GlobalMacroStorage_DocumentNew(ByVal Doc As Document, ByVal FromTemplate As Boolean, ByVal Template As String, ByVal IncludeGraphics As Boolean) BackgZoom End Sub Public Sub GlobalMacroStorage_DocumentOpen(ByVal Doc As Document, ByVal FileName As String) BackgZoom End Sub Private Sub BackgZoom() On Error Resume Next With ActiveDocument.MasterPage .Color.RGBAssign 165, 175, 175 End With If ActiveDocument.ActivePage.FindShapes.Count > 0 Then ActiveWindow.ActiveView.ToFitAllObjects Else ActiveWindow.ActiveView.ToFitPage End If End Sub
Wow, Perfect, Thankingyou sir
Sub SetObjectNameBasedOnSize() Dim shape As shape Dim sname As String ActiveDocument.Unit = cdrCentimeters For Each shape In ActiveSelectionRange.Shapes sname = "Shape_(W) " & Format(shape.SizeWidth / 100000, "0.#") & " x (H) " & Format(shape.SizeHeight / 100000, "0.#") & " Cm" shape.Name = sname Next End Subsir shall we incorporate this as globally (Auto Naming them)... so that object name is displayed as its actual size in object docker,