Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default HELP: opening/closing Excel remotely!!!!

Hi,

I have a complex Word macro that creates an Excel file from a template for
use within the macro. During a session the user may need to create multiple
Excel files.

I'm using the following code to open Excel and create the new file, by
declaring and then creating the procedure that follows:

Public xlbookbulk As Object

then, as a separate procedu

With Excel.Application
Workbooks.Open vPath & "\EnBulk Information.xlt"
..Application.Visible = True
Set xlbookbulk = .ActiveWorkbook
vBulkFileName = .ActiveWorkbook.Name
End With

Everything works wonderfully until the user closes the current/first Excel
file and attempts to construct a new one. The file is constructed but it
doesn't view...you can see the Excel toolbars and the formula and status bars
but the area in the centre (where the cells would normally appear) is void,
ie the screen behind is showing through. Strangely enough, the file is
actually there because you can cursor around and the Name box changes cells.

Now if you don't close the Excel file, you can create a new one
successfully. I'm wondering if the problem might have something to do with
Excel's status in Word...it thinks it's still open but it's not?????????

Any ideas? Is there a way to clear the contents of 'xlbokbulk' before
creating the new file?

Thanks,
Jille

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default opening/closing Excel remotely!!!!

You need to be more clear in your coding. Assuming you are using late
binding:

Dim XLApp as object
dim WB as object

set xlapp=creatobject("Excel.Application")
xlapp.visble=true
set wb=xlapp.workbooks.open(vPath & "\EnBulk Information.xlt")
vBulkFileName=wb.name
'....
wb.close, true
set wb=nothing
xlapp.quit
set xlapp=nothing

NickHK

"jille" wrote in message
...
Hi,

I have a complex Word macro that creates an Excel file from a template for
use within the macro. During a session the user may need to create

multiple
Excel files.

I'm using the following code to open Excel and create the new file, by
declaring and then creating the procedure that follows:

Public xlbookbulk As Object

then, as a separate procedu

With Excel.Application
Workbooks.Open vPath & "\EnBulk Information.xlt"
.Application.Visible = True
Set xlbookbulk = .ActiveWorkbook
vBulkFileName = .ActiveWorkbook.Name
End With

Everything works wonderfully until the user closes the current/first Excel
file and attempts to construct a new one. The file is constructed but it
doesn't view...you can see the Excel toolbars and the formula and status

bars
but the area in the centre (where the cells would normally appear) is

void,
ie the screen behind is showing through. Strangely enough, the file is
actually there because you can cursor around and the Name box changes

cells.

Now if you don't close the Excel file, you can create a new one
successfully. I'm wondering if the problem might have something to do with
Excel's status in Word...it thinks it's still open but it's not?????????

Any ideas? Is there a way to clear the contents of 'xlbokbulk' before
creating the new file?

Thanks,
Jille



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
OPENING AND CLOSING OF EXCEL 07 FILES hot-rod-3 Excel Discussion (Misc queries) 2 July 23rd 09 12:30 AM
Opening then later Closing an Excel file in VBA Richard Excel Discussion (Misc queries) 1 April 22nd 08 02:07 PM
Opening Excel file when connected to the system remotely TP Excel Discussion (Misc queries) 0 June 14th 07 09:52 PM
Error while opening/Closing excel Hari Excel Discussion (Misc queries) 0 November 17th 06 06:55 AM
Opening Excel remotely ibeetb Excel Programming 1 April 15th 04 03:04 PM


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