G
Gina
Hi all.
I am trying to customise Word for a particular template
( wanted to avoid macros in word )
I have 2 public variables:
Dim wrd As New Word.Application
Dim DC As Word.Document
which get initialised:
.....
Set wrd = New Word.Application
Set DC = wrd.Documents.Add("C:\Temp\My.dot")
isPrepaired = HideAllToolbars(wrd, DC)
......
the bottom function hides all the toolbars exept my own - fine so far
but when the user creates a new instance of word directly (through
normal.dot) as long as my document is still open, no commandbars are there
in that normal version of word :-((
I created a macro that re-enables all the available toolbars when closing my
document
so when my document is closed all is fine and word creates all the normal
commandbars.
Questions:
How can I catch only the currentInstance I created in access and apply my
hiding stuff only to that one ??
or
Do I have to create a macro in the global normal.dot to enable expicitely
toolbars when my document is open ?
(wanted to avoid stuff like that)
Many thanks for your help.
Gina
***
Function HideAllToolbars(curWRD As Word.Application, curDC As Word.Document)
Dim i As Integer
i = 1
curWRD.EnableCancelKey = wdCancelDisabled
curWRD.WindowState = wdWindowStateNormal
Do
curWRD.CommandBars(i).Enabled = False
i = i + 1
Loop While i <= (curWRD.CommandBars.Count)
curWRD.CommandBars.AdaptiveMenus = False
curWRD.CommandBars("Toolbar List").Enabled = False
curWRD.CommandBars("Rechnung").Enabled = True
curWRD.CommandBars("Rechnung").Visible = True
curWRD.EnableCancelKey = wdCancelInterrupt
End Function
I am trying to customise Word for a particular template
( wanted to avoid macros in word )
I have 2 public variables:
Dim wrd As New Word.Application
Dim DC As Word.Document
which get initialised:
.....
Set wrd = New Word.Application
Set DC = wrd.Documents.Add("C:\Temp\My.dot")
isPrepaired = HideAllToolbars(wrd, DC)
......
the bottom function hides all the toolbars exept my own - fine so far
but when the user creates a new instance of word directly (through
normal.dot) as long as my document is still open, no commandbars are there
in that normal version of word :-((
I created a macro that re-enables all the available toolbars when closing my
document
so when my document is closed all is fine and word creates all the normal
commandbars.
Questions:
How can I catch only the currentInstance I created in access and apply my
hiding stuff only to that one ??
or
Do I have to create a macro in the global normal.dot to enable expicitely
toolbars when my document is open ?
(wanted to avoid stuff like that)
Many thanks for your help.
Gina
***
Function HideAllToolbars(curWRD As Word.Application, curDC As Word.Document)
Dim i As Integer
i = 1
curWRD.EnableCancelKey = wdCancelDisabled
curWRD.WindowState = wdWindowStateNormal
Do
curWRD.CommandBars(i).Enabled = False
i = i + 1
Loop While i <= (curWRD.CommandBars.Count)
curWRD.CommandBars.AdaptiveMenus = False
curWRD.CommandBars("Toolbar List").Enabled = False
curWRD.CommandBars("Rechnung").Enabled = True
curWRD.CommandBars("Rechnung").Visible = True
curWRD.EnableCancelKey = wdCancelInterrupt
End Function