DISAPPEARING TOOLBARS - TOO HARD FOR EXCEL FORUM!!

J

jason

I have a macro in excel which utilises Word using late binding.
Generally its ok, especially if the user already has Word up and
running
on their machine.If they don't have word running then when they run
the macro the required doc will appear but in a
Word Document which has NO toolbars - therefore its a bit tricky
printing the document!!

Here's, pretty much, the code I'm using:


strApplication = "Word.Application"
'check to see if Word is running
If Not IsRunning(strApplication) Then
Set WordApplication = CreateObject(strApplication)
Else
Set WordApplication = GetObject(, strApplication)
End If
strApplication = ""

myFilePath = "I:\Fin\" & strFile & ".Doc"
myFileCopy = "I:\Fin\" & strFile & "\" & strFile & " " & Format(Now,
"dd mmm _ yyyy hh-mm-ss AMPM") & ".Doc"

FileSystem.FileCopy myFilePath, myFileCopy


Call CreateVariables 'creates all variables

With WordApplication
.screenupdating = false
'put in the data into the word document
With .documents.Open(Filename:=myFileCopy)
.Range.Bookmarks("Policy").Range.InsertAfter VAR1
.Range.Bookmarks("Date").Range.InsertAfter VAR2
.Range.Bookmarks("Fund").Range.InsertAfter VAR3
End With
.ACTIVEDOCUMENT.Save
.WindowState = 2
.SCREENUPDATING = TRUE
End With

Call DestroyVariables 'destroys all variables

ThisWorkbook.Activate
WordApplication.Visible = True
Set WordApplication = Nothing


ANY HELP ON THIS LITTLE TEASER IS GREATLY APPRECIATED

Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top