Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Control Word Document/ Current Instance from within Access

Discussion in 'Information Technology' started by Gina, Nov 15, 2005.

  1. Gina

    Gina
    Expand Collapse
    Guest

    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
     
  2. Loading...

    Similar Threads Forum Date
    How To Control The 5 Thieves? Questions and Answers Apr 7, 2016
    General Controlling Kaam (Lust) Hard Talk Apr 8, 2014
    USA Sikh Americans join Barack Obama in urging lawmakers on Gun Control Breaking News Mar 29, 2013
    Controversial SGPC Takes Control of Live Telecast at Bangla Sahib Hard Talk Feb 7, 2013
    USA Sikhs Join Gun Control Debate. Meet with Vice President Biden Breaking News Jan 16, 2013

  3. Tony Jollans

    Tony Jollans
    Expand Collapse
    Guest

    Hi Gina,

    Your tailoring is being done by default to the normal template. Before doing
    it, try setting the Customization Context


    Function HideAllToolbars(curWRD As Word.Application, curDC As Word.Document)
    Dim i As Integer
    i = 1

    CustomizationContext = curDC.Attachedtemplate

    curWRD.EnableCancelKey = wdCancelDisabled
    curWRD.WindowState = wdWindowStateNormal

    etc., etc.


    --
    Enjoy,
    Tony


    "Gina" <gin@freenet.de> wrote in message
    news:dl9o4j$42b$00$1@news.t-online.com...
    > 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
    >
    >
     
  4. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    That may be a Windows question, or may be a Word newsgroup question. It is
    not an Access question. Access is only acting as an automation client.
    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access

    "Gina" <gin@freenet.de> wrote in message
    news:dl9o4j$42b$00$1@news.t-online.com...
    > 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
    >
    >
     
  5. Gina

    Gina
    Expand Collapse
    Guest

    Hi Tony

    Thanks for your fast answer!!
    I have just added your line at the beginning as you suggested .... but
    unfortunatley it doesn't help.
    ....as long as my document in my instance of word is open, normal.dot still
    shows up with removed toolbars....

    ?:-|
    Gina

    "Tony Jollans" <My Forename at My Surname dot com> schrieb im Newsbeitrag
    news:uzlXrYQ6FHA.1140@tk2msftngp13.phx.gbl...
    > Hi Gina,
    >
    > Your tailoring is being done by default to the normal template. Before

    doing
    > it, try setting the Customization Context
    >
    >
    > Function HideAllToolbars(curWRD As Word.Application, curDC As

    Word.Document)
    > Dim i As Integer
    > i = 1
    >
    > CustomizationContext = curDC.Attachedtemplate
    >
    > curWRD.EnableCancelKey = wdCancelDisabled
    > curWRD.WindowState = wdWindowStateNormal
    >
    > etc., etc.
    >
    >
    > --
    > Enjoy,
    > Tony
    >
    >
    > "Gina" <gin@freenet.de> wrote in message
    > news:dl9o4j$42b$00$1@news.t-online.com...
    > > 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
    > >
    > >

    >
    >
     
  6. Gina

    Gina
    Expand Collapse
    Guest

    Arvin,

    yes, wrong group that were my fears as well so I did a cross-posting
    .... but windows question !!?.... oh no .... (how painful)

    Gina

    "Arvin Meyer [MVP]" <a@m.com> schrieb im Newsbeitrag
    news:ejMdBaQ6FHA.3880@TK2MSFTNGP12.phx.gbl...
    > That may be a Windows question, or may be a Word newsgroup question. It is
    > not an Access question. Access is only acting as an automation client.
    > --
    > Arvin Meyer, MCP, MVP
    > Microsoft Access
    > Free Access downloads
    > http://www.datastrat.com
    > http://www.mvps.org/access
    >
    > "Gina" <gin@freenet.de> wrote in message
    > news:dl9o4j$42b$00$1@news.t-online.com...
    > > 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
    > >
    > >

    >
    >
     
  7. Tony Jollans

    Tony Jollans
    Expand Collapse
    Guest

    Hi Gina,

    Sorry, I thought that would make a difference - and it does, sort of.

    When you have the "Windows in Taskbar" (under Tools > Options > View) set
    then you can have different commandbars in each Word window. When it is not
    set you only have the one 'window' (terminology is difficult here) and one
    set of active commandbar settings.

    You could control it further using Application Events to enable or disable
    the command bars when changing documents. But do you really want to give
    control back to the user in this way - it could destroy all your careful
    tailoring. As I'm sure you know from the various replies to your posts you
    can't have 100% success with this - whatever you do will be a compromise so
    is it necessary for users to be opening other documents with full control
    while they are interacting with your access-based word application?

    --
    Enjoy,
    Tony


    "Gina" <gin@freenet.de> wrote in message
    news:dl9pp3$v1h$02$1@news.t-online.com...
    > Hi Tony
    >
    > Thanks for your fast answer!!
    > I have just added your line at the beginning as you suggested .... but
    > unfortunatley it doesn't help.
    > ...as long as my document in my instance of word is open, normal.dot still
    > shows up with removed toolbars....
    >
    > ?:-|
    > Gina
    >
    > "Tony Jollans" <My Forename at My Surname dot com> schrieb im Newsbeitrag
    > news:uzlXrYQ6FHA.1140@tk2msftngp13.phx.gbl...
    > > Hi Gina,
    > >
    > > Your tailoring is being done by default to the normal template. Before

    > doing
    > > it, try setting the Customization Context
    > >
    > >
    > > Function HideAllToolbars(curWRD As Word.Application, curDC As

    > Word.Document)
    > > Dim i As Integer
    > > i = 1
    > >
    > > CustomizationContext = curDC.Attachedtemplate
    > >
    > > curWRD.EnableCancelKey = wdCancelDisabled
    > > curWRD.WindowState = wdWindowStateNormal
    > >
    > > etc., etc.
    > >
    > >
    > > --
    > > Enjoy,
    > > Tony
    > >
    > >
    > > "Gina" <gin@freenet.de> wrote in message
    > > news:dl9o4j$42b$00$1@news.t-online.com...
    > > > 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
    > > >
    > > >

    > >
    > >

    >
    >
     
  8. Gina

    Gina
    Expand Collapse
    Guest


    >
    > Sorry, I thought that would make a difference - and it does, sort of.


    well I am sure it does something.... I had to change my code to take the
    public variables as follows
    ...
    wrd.CustomizationContext = DC.AttachedTemplate

    wrd.EnableCancelKey = wdCancelDisabled
    wrd.WindowState = wdWindowStateNormal
    ....
    now stepping through before DC.AttachedTemplate is assigned to Context,
    wrd.CustomizationContext has 'normal.dot' as its value!!!

    after executing that line it has 'My.dot'

    >
    > When you have the "Windows in Taskbar" (under Tools > Options > View) set
    > then you can have different commandbars in each Word window. When it is

    not
    > set you only have the one 'window' (terminology is difficult here) and one
    > set of active commandbar settings.


    I work in office 2000 German version ... I have tried to find out the
    equivalent of what you describe .... not really successfully
    >
    > You could control it further using Application Events to enable or disable
    > the command bars when changing documents. But do you really want to give
    > control back to the user in this way - it could destroy all your careful
    > tailoring. As I'm sure you know from the various replies to your posts

    you
    > can't have 100% success with this - whatever you do will be a compromise

    so
    > is it necessary for users to be opening other documents with full control
    > while they are interacting with your access-based word application?


    Exactly .... that was going through my head as well (after post was
    sent).... maybe it is better as it is now ... so users have to first finish
    my stuff ( with word) and then could do whatever they like in Word and
    anywhere else ;-).... so yes you are right I do not want the full stuff!!

    I learned quite a bit doing this customisation thing with the group
    and the result gives me kind of 'security' - one eye kept closed ;-)
    ..... so I am fairly happy with it

    Many Thanks Tony,

    Gina
    >
    > --
    > Enjoy,
    > Tony
    >
    >
    > "Gina" <gin@freenet.de> wrote in message
    > news:dl9pp3$v1h$02$1@news.t-online.com...
    > > Hi Tony
    > >
    > > Thanks for your fast answer!!
    > > I have just added your line at the beginning as you suggested .... but
    > > unfortunatley it doesn't help.
    > > ...as long as my document in my instance of word is open, normal.dot

    still
    > > shows up with removed toolbars....
    > >
    > > ?:-|
    > > Gina
    > >
    > > "Tony Jollans" <My Forename at My Surname dot com> schrieb im

    Newsbeitrag
    > > news:uzlXrYQ6FHA.1140@tk2msftngp13.phx.gbl...
    > > > Hi Gina,
    > > >
    > > > Your tailoring is being done by default to the normal template. Before

    > > doing
    > > > it, try setting the Customization Context
    > > >
    > > >
    > > > Function HideAllToolbars(curWRD As Word.Application, curDC As

    > > Word.Document)
    > > > Dim i As Integer
    > > > i = 1
    > > >
    > > > CustomizationContext = curDC.Attachedtemplate
    > > >
    > > > curWRD.EnableCancelKey = wdCancelDisabled
    > > > curWRD.WindowState = wdWindowStateNormal
    > > >
    > > > etc., etc.
    > > >
    > > >
    > > > --
    > > > Enjoy,
    > > > Tony
    > > >
    > > >
    > > > "Gina" <gin@freenet.de> wrote in message
    > > > news:dl9o4j$42b$00$1@news.t-online.com...
    > > > > 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
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
  9. Tony Jollans

    Tony Jollans
    Expand Collapse
    Guest

    Word 2000 doesn't have the "Windows in Taskbar" option - it is always
    effectively on. The option was in Excel in 2000 but not introduced into Word
    until XP (2002).

    It is perfectly possible to have different commandbar settings in different
    documents/templates and I would have expected setting the customization
    context to have done it. However it seems that more explicit action is
    required to achieve it; there is clearly something I'm not understanding
    here but as you have decided against the approach I will leave it to another
    time to investigate fully.

    --
    Enjoy,
    Tony


    "Gina" <gin@freenet.de> wrote in message
    news:dla5dq$gbi$01$1@news.t-online.com...
    >
    >
    > >
    > > Sorry, I thought that would make a difference - and it does, sort of.

    >
    > well I am sure it does something.... I had to change my code to take the
    > public variables as follows
    > ...
    > wrd.CustomizationContext = DC.AttachedTemplate
    >
    > wrd.EnableCancelKey = wdCancelDisabled
    > wrd.WindowState = wdWindowStateNormal
    > ...
    > now stepping through before DC.AttachedTemplate is assigned to Context,
    > wrd.CustomizationContext has 'normal.dot' as its value!!!
    >
    > after executing that line it has 'My.dot'
    >
    > >
    > > When you have the "Windows in Taskbar" (under Tools > Options > View)

    set
    > > then you can have different commandbars in each Word window. When it is

    > not
    > > set you only have the one 'window' (terminology is difficult here) and

    one
    > > set of active commandbar settings.

    >
    > I work in office 2000 German version ... I have tried to find out the
    > equivalent of what you describe .... not really successfully
    > >
    > > You could control it further using Application Events to enable or

    disable
    > > the command bars when changing documents. But do you really want to give
    > > control back to the user in this way - it could destroy all your careful
    > > tailoring. As I'm sure you know from the various replies to your posts

    > you
    > > can't have 100% success with this - whatever you do will be a compromise

    > so
    > > is it necessary for users to be opening other documents with full

    control
    > > while they are interacting with your access-based word application?

    >
    > Exactly .... that was going through my head as well (after post was
    > sent).... maybe it is better as it is now ... so users have to first

    finish
    > my stuff ( with word) and then could do whatever they like in Word and
    > anywhere else ;-).... so yes you are right I do not want the full stuff!!
    >
    > I learned quite a bit doing this customisation thing with the group
    > and the result gives me kind of 'security' - one eye kept closed ;-)
    > .... so I am fairly happy with it
    >
    > Many Thanks Tony,
    >
    > Gina
    > >
    > > --
    > > Enjoy,
    > > Tony
    > >
    > >
    > > "Gina" <gin@freenet.de> wrote in message
    > > news:dl9pp3$v1h$02$1@news.t-online.com...
    > > > Hi Tony
    > > >
    > > > Thanks for your fast answer!!
    > > > I have just added your line at the beginning as you suggested .... but
    > > > unfortunatley it doesn't help.
    > > > ...as long as my document in my instance of word is open, normal.dot

    > still
    > > > shows up with removed toolbars....
    > > >
    > > > ?:-|
    > > > Gina
    > > >
    > > > "Tony Jollans" <My Forename at My Surname dot com> schrieb im

    > Newsbeitrag
    > > > news:uzlXrYQ6FHA.1140@tk2msftngp13.phx.gbl...
    > > > > Hi Gina,
    > > > >
    > > > > Your tailoring is being done by default to the normal template.

    Before
    > > > doing
    > > > > it, try setting the Customization Context
    > > > >
    > > > >
    > > > > Function HideAllToolbars(curWRD As Word.Application, curDC As
    > > > Word.Document)
    > > > > Dim i As Integer
    > > > > i = 1
    > > > >
    > > > > CustomizationContext = curDC.Attachedtemplate
    > > > >
    > > > > curWRD.EnableCancelKey = wdCancelDisabled
    > > > > curWRD.WindowState = wdWindowStateNormal
    > > > >
    > > > > etc., etc.
    > > > >
    > > > >
    > > > > --
    > > > > Enjoy,
    > > > > Tony
    > > > >
    > > > >
    > > > > "Gina" <gin@freenet.de> wrote in message
    > > > > news:dl9o4j$42b$00$1@news.t-online.com...
    > > > > > 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
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
  10. Gina

    Gina
    Expand Collapse
    Guest

    Thanks Tony....
    for all the thinking into my problem, your good advice and help!!!!

    I am very thankful !!
    Gina

    "Tony Jollans" <My Forename at My Surname dot com> schrieb im Newsbeitrag
    news:ON0$M6U6FHA.1416@TK2MSFTNGP09.phx.gbl...
    > Word 2000 doesn't have the "Windows in Taskbar" option - it is always
    > effectively on. The option was in Excel in 2000 but not introduced into

    Word
    > until XP (2002).
    >
    > It is perfectly possible to have different commandbar settings in

    different
    > documents/templates and I would have expected setting the customization
    > context to have done it. However it seems that more explicit action is
    > required to achieve it; there is clearly something I'm not understanding
    > here but as you have decided against the approach I will leave it to

    another
    > time to investigate fully.
    >
    > --
    > Enjoy,
    > Tony
    >
    >
    > "Gina" <gin@freenet.de> wrote in message
    > news:dla5dq$gbi$01$1@news.t-online.com...
    > >
    > >
    > > >
    > > > Sorry, I thought that would make a difference - and it does, sort of.

    > >
    > > well I am sure it does something.... I had to change my code to take the
    > > public variables as follows
    > > ...
    > > wrd.CustomizationContext = DC.AttachedTemplate
    > >
    > > wrd.EnableCancelKey = wdCancelDisabled
    > > wrd.WindowState = wdWindowStateNormal
    > > ...
    > > now stepping through before DC.AttachedTemplate is assigned to Context,
    > > wrd.CustomizationContext has 'normal.dot' as its value!!!
    > >
    > > after executing that line it has 'My.dot'
    > >
    > > >
    > > > When you have the "Windows in Taskbar" (under Tools > Options > View)

    > set
    > > > then you can have different commandbars in each Word window. When it

    is
    > > not
    > > > set you only have the one 'window' (terminology is difficult here) and

    > one
    > > > set of active commandbar settings.

    > >
    > > I work in office 2000 German version ... I have tried to find out the
    > > equivalent of what you describe .... not really successfully
    > > >
    > > > You could control it further using Application Events to enable or

    > disable
    > > > the command bars when changing documents. But do you really want to

    give
    > > > control back to the user in this way - it could destroy all your

    careful
    > > > tailoring. As I'm sure you know from the various replies to your

    posts
    > > you
    > > > can't have 100% success with this - whatever you do will be a

    compromise
    > > so
    > > > is it necessary for users to be opening other documents with full

    > control
    > > > while they are interacting with your access-based word application?

    > >
    > > Exactly .... that was going through my head as well (after post was
    > > sent).... maybe it is better as it is now ... so users have to first

    > finish
    > > my stuff ( with word) and then could do whatever they like in Word and
    > > anywhere else ;-).... so yes you are right I do not want the full

    stuff!!
    > >
    > > I learned quite a bit doing this customisation thing with the group
    > > and the result gives me kind of 'security' - one eye kept closed ;-)
    > > .... so I am fairly happy with it
    > >
    > > Many Thanks Tony,
    > >
    > > Gina
    > > >
    > > > --
    > > > Enjoy,
    > > > Tony
    > > >
    > > >
    > > > "Gina" <gin@freenet.de> wrote in message
    > > > news:dl9pp3$v1h$02$1@news.t-online.com...
    > > > > Hi Tony
    > > > >
    > > > > Thanks for your fast answer!!
    > > > > I have just added your line at the beginning as you suggested ....

    but
    > > > > unfortunatley it doesn't help.
    > > > > ...as long as my document in my instance of word is open, normal.dot

    > > still
    > > > > shows up with removed toolbars....
    > > > >
    > > > > ?:-|
    > > > > Gina
    > > > >
    > > > > "Tony Jollans" <My Forename at My Surname dot com> schrieb im

    > > Newsbeitrag
    > > > > news:uzlXrYQ6FHA.1140@tk2msftngp13.phx.gbl...
    > > > > > Hi Gina,
    > > > > >
    > > > > > Your tailoring is being done by default to the normal template.

    > Before
    > > > > doing
    > > > > > it, try setting the Customization Context
    > > > > >
    > > > > >
    > > > > > Function HideAllToolbars(curWRD As Word.Application, curDC As
    > > > > Word.Document)
    > > > > > Dim i As Integer
    > > > > > i = 1
    > > > > >
    > > > > > CustomizationContext = curDC.Attachedtemplate
    > > > > >
    > > > > > curWRD.EnableCancelKey = wdCancelDisabled
    > > > > > curWRD.WindowState = wdWindowStateNormal
    > > > > >
    > > > > > etc., etc.
    > > > > >
    > > > > >
    > > > > > --
    > > > > > Enjoy,
    > > > > > Tony
    > > > > >
    > > > > >
    > > > > > "Gina" <gin@freenet.de> wrote in message
    > > > > > news:dl9o4j$42b$00$1@news.t-online.com...
    > > > > > > 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
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
  11. Tony Jollans

    Tony Jollans
    Expand Collapse
    Guest

    My pleasure!

    --
    Enjoy,
    Tony


    "Gina" <gin@freenet.de> wrote in message
    news:dlc8ca$v45$03$1@news.t-online.com...
    > Thanks Tony....
    > for all the thinking into my problem, your good advice and help!!!!
    >
    > I am very thankful !!
    > Gina
    >
    > "Tony Jollans" <My Forename at My Surname dot com> schrieb im Newsbeitrag
    > news:ON0$M6U6FHA.1416@TK2MSFTNGP09.phx.gbl...
    > > Word 2000 doesn't have the "Windows in Taskbar" option - it is always
    > > effectively on. The option was in Excel in 2000 but not introduced into

    > Word
    > > until XP (2002).
    > >
    > > It is perfectly possible to have different commandbar settings in

    > different
    > > documents/templates and I would have expected setting the customization
    > > context to have done it. However it seems that more explicit action is
    > > required to achieve it; there is clearly something I'm not understanding
    > > here but as you have decided against the approach I will leave it to

    > another
    > > time to investigate fully.
    > >
    > > --
    > > Enjoy,
    > > Tony
    > >
    > >
    > > "Gina" <gin@freenet.de> wrote in message
    > > news:dla5dq$gbi$01$1@news.t-online.com...
    > > >
    > > >
    > > > >
    > > > > Sorry, I thought that would make a difference - and it does, sort

    of.
    > > >
    > > > well I am sure it does something.... I had to change my code to take

    the
    > > > public variables as follows
    > > > ...
    > > > wrd.CustomizationContext = DC.AttachedTemplate
    > > >
    > > > wrd.EnableCancelKey = wdCancelDisabled
    > > > wrd.WindowState = wdWindowStateNormal
    > > > ...
    > > > now stepping through before DC.AttachedTemplate is assigned to

    Context,
    > > > wrd.CustomizationContext has 'normal.dot' as its value!!!
    > > >
    > > > after executing that line it has 'My.dot'
    > > >
    > > > >
    > > > > When you have the "Windows in Taskbar" (under Tools > Options >

    View)
    > > set
    > > > > then you can have different commandbars in each Word window. When it

    > is
    > > > not
    > > > > set you only have the one 'window' (terminology is difficult here)

    and
    > > one
    > > > > set of active commandbar settings.
    > > >
    > > > I work in office 2000 German version ... I have tried to find out the
    > > > equivalent of what you describe .... not really successfully
    > > > >
    > > > > You could control it further using Application Events to enable or

    > > disable
    > > > > the command bars when changing documents. But do you really want to

    > give
    > > > > control back to the user in this way - it could destroy all your

    > careful
    > > > > tailoring. As I'm sure you know from the various replies to your

    > posts
    > > > you
    > > > > can't have 100% success with this - whatever you do will be a

    > compromise
    > > > so
    > > > > is it necessary for users to be opening other documents with full

    > > control
    > > > > while they are interacting with your access-based word application?
    > > >
    > > > Exactly .... that was going through my head as well (after post was
    > > > sent).... maybe it is better as it is now ... so users have to first

    > > finish
    > > > my stuff ( with word) and then could do whatever they like in Word and
    > > > anywhere else ;-).... so yes you are right I do not want the full

    > stuff!!
    > > >
    > > > I learned quite a bit doing this customisation thing with the group
    > > > and the result gives me kind of 'security' - one eye kept closed ;-)
    > > > .... so I am fairly happy with it
    > > >
    > > > Many Thanks Tony,
    > > >
    > > > Gina
    > > > >
    > > > > --
    > > > > Enjoy,
    > > > > Tony
    > > > >
    > > > >
    > > > > "Gina" <gin@freenet.de> wrote in message
    > > > > news:dl9pp3$v1h$02$1@news.t-online.com...
    > > > > > Hi Tony
    > > > > >
    > > > > > Thanks for your fast answer!!
    > > > > > I have just added your line at the beginning as you suggested ....

    > but
    > > > > > unfortunatley it doesn't help.
    > > > > > ...as long as my document in my instance of word is open,

    normal.dot
    > > > still
    > > > > > shows up with removed toolbars....
    > > > > >
    > > > > > ?:-|
    > > > > > Gina
    > > > > >
    > > > > > "Tony Jollans" <My Forename at My Surname dot com> schrieb im
    > > > Newsbeitrag
    > > > > > news:uzlXrYQ6FHA.1140@tk2msftngp13.phx.gbl...
    > > > > > > Hi Gina,
    > > > > > >
    > > > > > > Your tailoring is being done by default to the normal template.

    > > Before
    > > > > > doing
    > > > > > > it, try setting the Customization Context
    > > > > > >
    > > > > > >
    > > > > > > Function HideAllToolbars(curWRD As Word.Application, curDC As
    > > > > > Word.Document)
    > > > > > > Dim i As Integer
    > > > > > > i = 1
    > > > > > >
    > > > > > > CustomizationContext = curDC.Attachedtemplate
    > > > > > >
    > > > > > > curWRD.EnableCancelKey = wdCancelDisabled
    > > > > > > curWRD.WindowState = wdWindowStateNormal
    > > > > > >
    > > > > > > etc., etc.
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > > Enjoy,
    > > > > > > Tony
    > > > > > >
    > > > > > >
    > > > > > > "Gina" <gin@freenet.de> wrote in message
    > > > > > > news:dl9o4j$42b$00$1@news.t-online.com...
    > > > > > > > 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
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     

Share This Page