Office 2007 hidden properties - threat or menace?

B

brucedodds

I'm working on a project to convert corporate Office documents from
Office 2003 to 2007. My question has to do with object properties
that were exposed in Office 2003 and are now hidden.

To use a Word example, see this code:

START OF CODE

If System.Country = 1 Or System.Country = 2 Then
ActiveDocument.PageSetup.PaperSize = wdPaperLetter
Else
ActiveDocument.PageSetup.PaperSize = wdPaperA4
End If

END OF CODE

"System.Country" is now a hidden property, but when run in Word 2007
this code produces the same result it did in Word 2003. In the
Immediate window, when this line is entered:
?System.Country
a value is displayed in the window.


An Excel example using the hidden OutlineFont property:

START OF CODE

With ActiveCell.Characters(Start:=1, Length:=8).Font
. . .
.OutlineFont = False
. . .
End With

END OF CODE

This code executes without throwing an error. However, in the
Immediate window, when this line is entered:
?ActiveCell.Outlinefont
VBA displays the message "Run-time error '438'. Object doesn't
support this property or method."

It appears that some properties such as System.Country, are hidden
because they're deprecated. Other properties, such as
ActiveCell.OutlineFont, are hidden because they no longer exist.

The challenge is that the tool we're using to scan Office files for
conversion problems flags all references to properties that were
exposed in 2003 and hidden in 2007 as errors, whether or not they
affect how the application runs. There are scores of these
properties. If anyone knows of a reference that classifies hidden
Office 2007 properties based on how they affect the application,
please let me know.

Thanks.
 
S

Steve Rindsberg

(e-mail address removed)>, (e-mail address removed)
wrote:
I'm working on a project to convert corporate Office documents from
Office 2003 to 2007. My question has to do with object properties
that were exposed in Office 2003 and are now hidden.

To use a Word example, see this code:

START OF CODE

If System.Country = 1 Or System.Country = 2 Then
ActiveDocument.PageSetup.PaperSize = wdPaperLetter
Else
ActiveDocument.PageSetup.PaperSize = wdPaperA4
End If

END OF CODE

"System.Country" is now a hidden property, but when run in Word 2007
this code produces the same result it did in Word 2003. In the
Immediate window, when this line is entered:
?System.Country
a value is displayed in the window.

An Excel example using the hidden OutlineFont property:

START OF CODE

With ActiveCell.Characters(Start:=1, Length:=8).Font
. . .
.OutlineFont = False
. . .
End With

END OF CODE

This code executes without throwing an error. However, in the
Immediate window, when this line is entered:
?ActiveCell.Outlinefont
VBA displays the message "Run-time error '438'. Object doesn't
support this property or method."

It appears that some properties such as System.Country, are hidden
because they're deprecated. Other properties, such as
ActiveCell.OutlineFont, are hidden because they no longer exist.

The challenge is that the tool we're using to scan Office files for
conversion problems flags all references to properties that were
exposed in 2003 and hidden in 2007 as errors, whether or not they
affect how the application runs. There are scores of these
properties. If anyone knows of a reference that classifies hidden
Office 2007 properties based on how they affect the application,
please let me know.

I don't know of any reference that lists this info as such, but from
the IDE, press F2 to open the Object Browser. Rightclick in e.g. the
Members Of ... pane and choose Show Hidden Members.

Now two things will happen:

- Hidden methods/properties will appear (but grayed so you know they're
hidden)

- Code that invokes hidden methods/properties will run w/o compile
errors, so long as it's correct.

The new Font2 object exposes the new way of doing some things ... it
has Line and Fill objects for example. Near as I can tell, at least
some of the new stuff seems to buffalo Intellisense in Excel's IDE
though.
 
M

Minghwa_Lee

It's very helpful, thanks. I am seeking a method to arrange the printing
format.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top