Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default PLEASE, PLEASE, PLEASE HELLLLP!!! Excel macro destroying Word toolbars !

I have a macro in excel which utilises Word using late binding.
Generally its ok but, especially if the user already has Word running
on their machine.If it is the morning and they don't have word running
then when they run the macro the required sheet 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 the following variables starting
with "my"

With WordApplication
'put in the data into the word document
With .documents.Open(Filename:=myFileCopy)
.Range.Bookmarks("Policy_Number").Range.InsertAfte r
myPNumber
.Range.Bookmarks("The_Date").Range.InsertAfter myDate
.Range.Bookmarks("Fund_Description").Range.InsertA fter
_ myDescription
End With
.ACTIVEDOCUMENT.Save
.WindowState = wdWindowStateMinimize
End With

Call DestroyVariables 'destroys all variables starting with "my"

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


ANY HELP ON THIS LITTLE TEASER IS GREATLY APPRECIATED

Jason
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default PLEASE, PLEASE, PLEASE HELLLLP!!! Excel macro destroying Word toolbars !

Jason: I use
doc = Fpath & "\" & Fname & ".doc"
Set WD = CreateObject("Word.Application")
WD.Documents.Open doc
WD.Visible = True
several times each day from my workbook. I always get my full Normal.dot
template, with all the toolbars I had open. You might try posting this to a
Word NG (make sure you point out which line is giving you trouble).

Ed

"jason" wrote in message
om...
I have a macro in excel which utilises Word using late binding.
Generally its ok but, especially if the user already has Word running
on their machine.If it is the morning and they don't have word running
then when they run the macro the required sheet 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 the following variables starting
with "my"

With WordApplication
'put in the data into the word document
With .documents.Open(Filename:=myFileCopy)
.Range.Bookmarks("Policy_Number").Range.InsertAfte r
myPNumber
.Range.Bookmarks("The_Date").Range.InsertAfter myDate
.Range.Bookmarks("Fund_Description").Range.InsertA fter
_ myDescription
End With
.ACTIVEDOCUMENT.Save
.WindowState = wdWindowStateMinimize
End With

Call DestroyVariables 'destroys all variables starting with "my"

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


ANY HELP ON THIS LITTLE TEASER IS GREATLY APPRECIATED

Jason



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default PLEASE, PLEASE, PLEASE HELLLLP!!! Excel macro destroying Word toolbars !

cheers for the help matey

if you try adding stuff into the document and the making it visible
you'll probably get the same problem
but if you make it visible and then manipulate the document then all
is well - PROBLEM SOLVED

Jason

"Ed" wrote in message ...
Jason: I use
doc = Fpath & "\" & Fname & ".doc"
Set WD = CreateObject("Word.Application")
WD.Documents.Open doc
WD.Visible = True
several times each day from my workbook. I always get my full Normal.dot
template, with all the toolbars I had open. You might try posting this to a
Word NG (make sure you point out which line is giving you trouble).

Ed

"jason" wrote in message
om...
I have a macro in excel which utilises Word using late binding.
Generally its ok but, especially if the user already has Word running
on their machine.If it is the morning and they don't have word running
then when they run the macro the required sheet 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 the following variables starting
with "my"

With WordApplication
'put in the data into the word document
With .documents.Open(Filename:=myFileCopy)
.Range.Bookmarks("Policy_Number").Range.InsertAfte r
myPNumber
.Range.Bookmarks("The_Date").Range.InsertAfter myDate
.Range.Bookmarks("Fund_Description").Range.InsertA fter
_ myDescription
End With
.ACTIVEDOCUMENT.Save
.WindowState = wdWindowStateMinimize
End With

Call DestroyVariables 'destroys all variables starting with "my"

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


ANY HELP ON THIS LITTLE TEASER IS GREATLY APPRECIATED

Jason

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
add delta symbol to toolbars in word and excel JT Excel Discussion (Misc queries) 2 May 24th 06 12:30 PM
the toolbars in Word has gone missing. even after reinstalling LIM TP Excel Discussion (Misc queries) 2 August 20th 05 01:27 PM
Creating/Destroying Toolbars Programmatically Syed Zeeshan Haider[_5_] Excel Programming 2 January 27th 04 05:32 AM
Does destroying the ADO Connection close the database? Richard Choate Excel Programming 0 July 18th 03 07:45 PM


All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"