Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default open word from excel & then back again

i need to open word from excel and then close word & open excel again. i have
a form that opens in excel without showing excel, only the form is visibe on
start up with command buttons to open different documents. i can open word
but it does not make it the active item. It sits at the bottom of the screen,
not visible for use. Second question; when i open another excel workbook and
then try to close and return to the original form the original form will not
display, can anyone help me?
code i am using below for first problem and also second problem.

Private Sub CommandButton1_Click()
Unload Me
Dim Word As New Word.Application
Dim WordDoc As New Word.Document

Set WordDoc = Word.Documents.Open("D:\NSS BULK\KUSTOM CONCRETE\Kustom
Working Documents\Safety\document register")
Word.Visible = True
End Sub


Private Sub CommandButton2_Click()
'saves and closes this workbook while opening the Switchboard workbook
Workbooks("Permit Register.XLS").Close SaveChanges:=True
Workbooks.Open ("D:\NSS BULK\KUSTOM CONCRETE\Kustom Working
Documents\SWITCHBOARD")

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default open word from excel & then back again

I would advise not to use object words as names of variables for a start.
e.g. Use
Dim WordApp As New Word.Application

If you do not close Excel, you do not need to open it again.
Maybe use Me.Hide instead of Unload Me

I think the problem is that you are closing the WB containing the running
code.
Use a single WB (or add-in) to contain all the code that manipulates the
other Word docs and Excel WBs.

NickHK

"new_to_vba" wrote in message
...
i need to open word from excel and then close word & open excel again. i

have
a form that opens in excel without showing excel, only the form is visibe

on
start up with command buttons to open different documents. i can open word
but it does not make it the active item. It sits at the bottom of the

screen,
not visible for use. Second question; when i open another excel workbook

and
then try to close and return to the original form the original form will

not
display, can anyone help me?
code i am using below for first problem and also second problem.

Private Sub CommandButton1_Click()
Unload Me
Dim Word As New Word.Application
Dim WordDoc As New Word.Document

Set WordDoc = Word.Documents.Open("D:\NSS BULK\KUSTOM CONCRETE\Kustom
Working Documents\Safety\document register")
Word.Visible = True
End Sub


Private Sub CommandButton2_Click()
'saves and closes this workbook while opening the Switchboard workbook
Workbooks("Permit Register.XLS").Close SaveChanges:=True
Workbooks.Open ("D:\NSS BULK\KUSTOM CONCRETE\Kustom Working
Documents\SWITCHBOARD")

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default open word from excel & then back again

hit wrong button and posted as a question. Thanks NickHK, i will try that .


"NickHK" wrote:

I would advise not to use object words as names of variables for a start.
e.g. Use
Dim WordApp As New Word.Application

If you do not close Excel, you do not need to open it again.
Maybe use Me.Hide instead of Unload Me

I think the problem is that you are closing the WB containing the running
code.
Use a single WB (or add-in) to contain all the code that manipulates the
other Word docs and Excel WBs.

NickHK

"new_to_vba" wrote in message
...
i need to open word from excel and then close word & open excel again. i

have
a form that opens in excel without showing excel, only the form is visibe

on
start up with command buttons to open different documents. i can open word
but it does not make it the active item. It sits at the bottom of the

screen,
not visible for use. Second question; when i open another excel workbook

and
then try to close and return to the original form the original form will

not
display, can anyone help me?
code i am using below for first problem and also second problem.

Private Sub CommandButton1_Click()
Unload Me
Dim Word As New Word.Application
Dim WordDoc As New Word.Document

Set WordDoc = Word.Documents.Open("D:\NSS BULK\KUSTOM CONCRETE\Kustom
Working Documents\Safety\document register")
Word.Visible = True
End Sub


Private Sub CommandButton2_Click()
'saves and closes this workbook while opening the Switchboard workbook
Workbooks("Permit Register.XLS").Close SaveChanges:=True
Workbooks.Open ("D:\NSS BULK\KUSTOM CONCRETE\Kustom Working
Documents\SWITCHBOARD")

End Sub




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
Excel 2007-send Word Art text to back tinks Excel Discussion (Misc queries) 3 May 4th 09 06:20 PM
Long text, Excel to Word, then back again Geoff C Excel Discussion (Misc queries) 0 December 3rd 08 03:14 PM
Excel document was saved to word in error how do I get it back Janice Excel Discussion (Misc queries) 1 May 29th 06 03:45 PM
Excel to Word and back again Rominall Excel Programming 1 February 16th 06 04:07 PM
Embedded word doc changed to image-need to change back to word. cflores Excel Discussion (Misc queries) 0 January 23rd 05 06:45 AM


All times are GMT +1. The time now is 09:05 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"