X
XmlAdoNewbie
Hi All,
I have a word template that opens to a form in which the user can
select a word document and open it for edit. This all works pretty
good, it starts to act a bit *WONKY* when i try and add my own custom
tool bar, What i want to be able to do is open the word document
WITHOUT ANY MENU's and just have my own menu that will have save,
close, bullets, font size, italics and bold but that's it. I can open
the word document without any menu's however when i try and add my
custom menu a few things happen that are unexpected.
1) my tool bar does not show up, but if i try and open it under the
"view" menu option i can see it in the list of toolbars.
2) when i try and close the application i get the error "This file is
in use by another application or user (C:\\.....normal.dot). so then i
say ok to this dialog and another dialog comes up and says "Changes
have been made that affect the global template. Do you want to save
those changes?" and i say cancel and it will close properly..
Here is my code
Private Sub cmdEdit_Click()
Dim newCommandBar As CommandBar
Dim newCommandBarControl As CommandBarControl
Set docApp = New Word.Application
With docApp
.Visible = True
.WindowState = wdWindowStateMaximize
End With
docApp.CommandBars("Menu Bar").Enabled = True
docApp.CommandBars("Formatting").Visible = False
docApp.CommandBars("Standard").Visible = False
Set newCommandBar = docApp.CommandBars.Add("Doclet Editor",
msoBarFloating, , True)
Set newCommandBarControl = newCommandBar.Controls.Add
With newCommandBarControl
.Caption = "Save"
.Visible = True
End With
ActiveDocument.ActiveWindow = docApp.Documents.Open(docletPath &
Me.txtSource)
'Me.txtSource is the path to the document i want to open.
End Sub
Any ideas??
I have a word template that opens to a form in which the user can
select a word document and open it for edit. This all works pretty
good, it starts to act a bit *WONKY* when i try and add my own custom
tool bar, What i want to be able to do is open the word document
WITHOUT ANY MENU's and just have my own menu that will have save,
close, bullets, font size, italics and bold but that's it. I can open
the word document without any menu's however when i try and add my
custom menu a few things happen that are unexpected.
1) my tool bar does not show up, but if i try and open it under the
"view" menu option i can see it in the list of toolbars.
2) when i try and close the application i get the error "This file is
in use by another application or user (C:\\.....normal.dot). so then i
say ok to this dialog and another dialog comes up and says "Changes
have been made that affect the global template. Do you want to save
those changes?" and i say cancel and it will close properly..
Here is my code
Private Sub cmdEdit_Click()
Dim newCommandBar As CommandBar
Dim newCommandBarControl As CommandBarControl
Set docApp = New Word.Application
With docApp
.Visible = True
.WindowState = wdWindowStateMaximize
End With
docApp.CommandBars("Menu Bar").Enabled = True
docApp.CommandBars("Formatting").Visible = False
docApp.CommandBars("Standard").Visible = False
Set newCommandBar = docApp.CommandBars.Add("Doclet Editor",
msoBarFloating, , True)
Set newCommandBarControl = newCommandBar.Controls.Add
With newCommandBarControl
.Caption = "Save"
.Visible = True
End With
ActiveDocument.ActiveWindow = docApp.Documents.Open(docletPath &
Me.txtSource)
'Me.txtSource is the path to the document i want to open.
End Sub
Any ideas??