Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Altering an open excel document

I have an excel document that I sometimes work on manually, and
sometimes have outlook alter via:

Dim xl As New Excel.Application
Dim xlwbook As Excel.Workbook
Set xlwbook = xl.Workbooks.Open("C:\...\spreadsheet.xls")
.... etc

The problem:
This works fine, but currently, when I have outlook edit the
spreadsheet, I have to close it so that there aren't two instances
open (to create conflicts, forget to save work, etc).

The question:
Is there a way of editing the open spreadsheet if it is currently
open, and otherwise, open a new instance (as I'm currently doing)?

so:

Dim xl As New Excel.Application
Dim xlwbook As Excel.Workbook
if workbookIsCurrentlyOpen("C:\...\spreadsheet.xls") then '
pseudocode
Set xlwbook = referenceExistingInstanceOf("C:\...
\spreadsheet.xls") ' pseudocode
else
Set xlwbook = xl.Workbooks.Open("C:\...\spreadsheet.xls")
end if
.... etc

Thanks,
Eric

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Altering an open excel document

Maybe try using GetObject .

NickHK

"umop" wrote in message
oups.com...
I have an excel document that I sometimes work on manually, and
sometimes have outlook alter via:

Dim xl As New Excel.Application
Dim xlwbook As Excel.Workbook
Set xlwbook = xl.Workbooks.Open("C:\...\spreadsheet.xls")
... etc

The problem:
This works fine, but currently, when I have outlook edit the
spreadsheet, I have to close it so that there aren't two instances
open (to create conflicts, forget to save work, etc).

The question:
Is there a way of editing the open spreadsheet if it is currently
open, and otherwise, open a new instance (as I'm currently doing)?

so:

Dim xl As New Excel.Application
Dim xlwbook As Excel.Workbook
if workbookIsCurrentlyOpen("C:\...\spreadsheet.xls") then '
pseudocode
Set xlwbook = referenceExistingInstanceOf("C:\...
\spreadsheet.xls") ' pseudocode
else
Set xlwbook = xl.Workbooks.Open("C:\...\spreadsheet.xls")
end if
... etc

Thanks,
Eric



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
I forgot my password to open an excel document, how do I open it? chris ohearn Excel Discussion (Misc queries) 1 August 11th 08 02:32 PM
Open an Excel document in 2007 document using the 2003 office Peter Excel Programming 1 October 23rd 06 06:41 PM
my excel document won't open unless i go file, then open EB500 Excel Discussion (Misc queries) 1 June 3rd 05 06:42 PM
why must I open an Excel document twice to get it to open after . NottaBoy Excel Discussion (Misc queries) 1 May 17th 05 09:22 AM
When I open excel document it always ask if I want to open it in . dperkins Excel Discussion (Misc queries) 0 February 15th 05 08:11 PM


All times are GMT +1. The time now is 02:25 PM.

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

About Us

"It's about Microsoft Excel"