|
-
Sep 12th, 2000, 04:00 PM
#1
Thread Starter
Fanatic Member
why do you need to do this, if you need to change parameters then use the property equivelent:
- Open Word
- Record a new macro
- Open the Templates and Addins window
- Make any and all changes and click OK
- Open the VBA Editor, find the macro, and use the properties it set to change those setttintgs
Other wise try this:
Code:
'copied from another thread and modified, not my code:
'Mathew Gates code
Public Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Public Declare Function SendMessageLong& Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long)
Declare Function GetMenu Lib "user32" _
(ByVal hwnd As Long) As Long
Declare Function GetSubMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPos As Long) As Long
Declare Function GetMenuItemID Lib "user32" _
(ByVal hMenu As Long, ByVal nPos As Long) As Long
Declare Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Long
Private Declare Function GetMenuString Lib "user32" _
Alias "GetMenuStringA" (ByVal hMenu As Long, ByVal _
wIDItem As Long, ByVal lpString As String, ByVal nMaxCount _
As Long, ByVal wFlag As Long) As Long
Public Const WM_COMMAND = &H111
Private Sub Command1_Click()
Dim notepad As Long
notepad = FindWindow("winword", vbNullString)
Dim TheWindow As Long
Dim aMenu As Long
Dim mCount As Long
Dim LookFor As Long
Dim sMenu As Long
Dim sCount As Long
Dim LookSub As Long
Dim sID As Long
Dim sString As String
TheWindow = notepad
aMenu& = GetMenu(TheWindow)
mCount& = GetMenuItemCount(aMenu&)
For LookFor& = 0& To mCount& - 1
sMenu& = GetSubMenu(aMenu&, LookFor&)
sCount& = GetMenuItemCount(sMenu&)
For LookSub& = 0 To sCount& - 1
sID& = GetMenuItemID(sMenu&, LookSub&)
sString$ = String$ (100 , " ")
Call GetMenuString(sMenu&, sID&, sString$, 100&, 1&)
If InStr(LCase(sString$), LCase("Templates and Add-&Ins…")) Then
Call SendMessageLong(TheWindow, WM_COMMAND, sID&, 0&)
Exit Sub
End If
Next LookSub&
Next LookFor&
End Sub
don't know the class of word, you must find that out before above code will work!!!!
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|