• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

Read Frame properties... VBA

Question: What is the syntax to read the properties of a frame?
                   (Please verify and fill in the missing.)

ActiveDocument.Frames(intFrmCount).Select

   PageNoVal = ActiveDocument.Frames(intFrmCount).Range.Information(wdActiveEndPageNumber)
   PagesVal  = ?
   LeftVal  = ?
   TopVal  = ActiveDocument.Frames(intFrmCount).VerticalPosition
   FontSizeVal = Selection.Font.Size
   FontTypeVal  = ?
   BoldYNVal  = ?
   ItalicYNVal  = ?
   UnderLineYNVal = ?
   FrameWidthVal = ActiveDocument.Frames(intFrmCount).Width
   FrameHeightVal = ActiveDocument.Frames(intFrmCount).Height
   TextColorVal  = ?
   strVal= ActiveDocument.Frames(intFrmCount).Range.Text

Thank you.
0
Mike Eghtebas
Asked:
Mike Eghtebas
  • 4
  • 2
1 Solution
 
geneusCommented:
  PageNoVal = ActiveDocument.Frames(intFrmCount).Range.Information(wdActiveEndPageNumber)
   PagesVal  = <= Unsure of what you are looking for here please add more info
   LeftVal  = ActiveDocument.Frames(intFrmCount).HorizontalPosition
   TopVal  = ActiveDocument.Frames(intFrmCount).VerticalPosition
   FrameWidthVal = ActiveDocument.Frames(intFrmCount).Width
   FrameHeightVal = ActiveDocument.Frames(intFrmCount).Height
   strVal= ActiveDocument.Frames(intFrmCount).Range.Text


These work with the Selection Method:

ActiveDocument.Frames(1).Select

MsgBox Selection.Font.Bold
MsgBox Selection.Font.Size
MsgBox Selection.Font.Italic
MsgBox Selection.Font.Underline
MsgBox Selection.Font.name
MsgBox Selection.Font.Color

'Returns 0 for No and -1 for Yes except for Underline.  It returns 0 for No and 1 for Yes.

   FontSizeVal = Selection.Font.Size
   FontTypeVal = Selection.Font.name
   BoldYNVal = Selection.Font.Bold
   ItalicYNVal = Selection.Font.Italic
   UnderLineYNVal = Selection.Font.Underline
   
'Color Returns the following
   TextColorVal = Selection.Font.Color
    'colors Returns
    'wdAuto         0
    'wdBlack        1
    'wdBlue         2
    'wdBrightGreen  4
    'wdDarkBlue     9
    'wdDarkRed      13
    'wdDarkYellow   14
    'wdGray25       16
    'wdGray50       15
    'wdGreen        11
    'wdNoHighlight  0
    'wdPink         5
    'wdRed          6
    'wdTeal         10
    'wdTurquoise    3
    'wdViolet       12
    'wdWhite        8
    'wdYellow       7
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thanks.
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
re:> PagesVal  = <= Unsure of what you are looking for here please add more info

This relates to total pages.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
geneusCommented:
Sub PageCount()
MsgBox ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages)
PagesVal  = ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages)
End Sub
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Following works:
       
PageNoVal = ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages)
       
PagesVal = ActiveDocument.Frames(intFrmCount).Range.Information(wdActiveEndPageNumber)

Thanks,

Mike
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now