Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Displaying a Custom Toolbar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gilley - 18 Jan 2005 17:29 GMT
I have a template which in turns opens a new document with the contents of a
text file.

I have a custom toolbar which contains buttons to specific macros that
format the text files in a number of different ways.  Invoice, Purchase
Order, Sales Order, etc.

The custom toolbar is in my template, but I can't seem to figure out how to
make it visible in the new document created based on the template.  I have
searched through the discussion groups and found what I thought was the
solution but it isn't working.

Private Sub Document_Open()

    CommandBars("Faxing from Certiflex").Visible = True

End Sub

This was a solution that I ran across.  It seems to make sense, however, it
isn't working!

Any suggestions out there??

Thanks,
Gilley
Charles Kenyon - 18 Jan 2005 19:21 GMT
Try naming it Document_New() instead or in addition.

New works on newly created documents. Open works on existing documents.
Signature


Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

>I have a template which in turns opens a new document with the contents of
>a
[quoted text clipped - 24 lines]
> Thanks,
> Gilley
Gilley - 18 Jan 2005 19:35 GMT
Charles,

Thanks for the quick response.  I was just thinking along those lines.

I am already using the Document_New() to open the text file.  I began
thinking that the new document may not be based on my template.  After I ran
the Document_New() macro, I checked under Tools/Templates & Add ins.  It is
showing NORMAL not CFDRPT.DOT.

How can I force my new document to use the correct template?  Let me mention
this also.  I am using a VBS script to launch Word and start a new document
based on the template I specify.  Here is the code from my VBS file.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim oWord
On Error Resume Next

Set oWord = GetObject("Word.Application")
If oWord Is Nothing Then
Set oWord = CreateObject("Word.Application")
End If

If oWord Is Nothing Then
MsgBox "Could not start Word"
Else
oWord.Visible = True
  ' the following command must all be one line
oWord.Documents.Add("c:\cfdrptp.dot")
End If
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Any suggestions?

Thanks,
Gilley

> Try naming it Document_New() instead or in addition.
>
[quoted text clipped - 27 lines]
> > Thanks,
> > Gilley
Charles Kenyon - 18 Jan 2005 20:14 GMT
> How can I force my new document to use the correct template?

How about simply using your template as the basis for the new document? Then
the document is attached to the template. I don't do VB programming but only
vba. Nevertheless, I assume that your application can do this.
Signature


Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Charles,
>
[quoted text clipped - 69 lines]
>> > Thanks,
>> > Gilley
Gilley - 18 Jan 2005 21:03 GMT
Thanks Charles.  That is what I ended up doing.  After your last message, I
started thinking along those lines and added:

   ActiveDocument.AttachedTemplate = "c:\cfdrptp.dot"

to the Document_New().

Thanks for your help.

Gilley

> > How can I force my new document to use the correct template?
>
[quoted text clipped - 74 lines]
> >> > Thanks,
> >> > Gilley

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.