Answered by:
Template menu in 2003 and 2010

Question
-
Hi,
My office has a mix of Word 2003 and 2010 users, and I have a startup template that builds a forms menu in Word 2003 adding that menu to the main menu. When I run the same template in Word 2010 (without any modification for 2010), it puts the menu on the Add-Ins tab instead of creating a new tab on the ribbon. This is pretty good so far.
But, is there a way, in the VBA code of the template macros to: 1) learn what version of Word is running the macro, and 2) direct the macro to construct the menu as a main tab on the ribbon instead of in the default Add-Ins location?
Since the macro runs each time Word opens, and removes the existing menu before creating the new one( which might have new or modified selections on it), it does not seem to be an option to merely move the menu manually after it appears on the Add-Ins menu to a new tab by using ribbon customization, and I would also prefer not to have to detour into learning xml scripting to get this task done--but I will if it's really the easiest way.
TIA,
Peter
Wednesday, February 22, 2012 5:01 PM
Answers
-
Hi,
Please test following code, hope this helpful:
'########################
'Get the version of Word.
'########################
Public Function GetWordVersion() As String
GetWordVersion = Application.Version
End Function
Sub Demo()
Dim strWordVer As StringstrWordVer = GetWordVersion
If strWordVer = "11.0" Then
'Processing 1...
ElseIf strWordVer = "14.0" Then'Processing 2...
End If
End SubNote: You need add macro code that have been designed for Word 2003 & 2010 to "Processing1" & "Processing2"
"11.0" = Word 2003
"14.0" = Word 2010
Best regards.
William Zhou
TechNet Community Support
- Edited by William Zhou CHN Monday, February 27, 2012 4:56 AM
- Marked as answer by William Zhou CHN Monday, March 5, 2012 3:06 AM
Monday, February 27, 2012 4:55 AM
All replies
-
Hi,
Please test following code, hope this helpful:
'########################
'Get the version of Word.
'########################
Public Function GetWordVersion() As String
GetWordVersion = Application.Version
End Function
Sub Demo()
Dim strWordVer As StringstrWordVer = GetWordVersion
If strWordVer = "11.0" Then
'Processing 1...
ElseIf strWordVer = "14.0" Then'Processing 2...
End If
End SubNote: You need add macro code that have been designed for Word 2003 & 2010 to "Processing1" & "Processing2"
"11.0" = Word 2003
"14.0" = Word 2010
Best regards.
William Zhou
TechNet Community Support
- Edited by William Zhou CHN Monday, February 27, 2012 4:56 AM
- Marked as answer by William Zhou CHN Monday, March 5, 2012 3:06 AM
Monday, February 27, 2012 4:55 AM -
Thanks for the code. I'll try it out. I checked into Greg Maxey's website and found his tutorials on modifying the ribbon XML and macro coding. Emboldened by all that good stuff, I redid my 2003 menus and macros for 2010 this weekend and the results are quite satisfying. So, I think it will not be too bad to develop in parallel until we get off of 2003 altogether.
Thanks again.
Monday, February 27, 2012 10:25 PM -