Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I forgot my password to open an excel document, how do I open it? | Excel Discussion (Misc queries) | |||
Open an Excel document in 2007 document using the 2003 office | Excel Programming | |||
my excel document won't open unless i go file, then open | Excel Discussion (Misc queries) | |||
why must I open an Excel document twice to get it to open after . | Excel Discussion (Misc queries) | |||
When I open excel document it always ask if I want to open it in . | Excel Discussion (Misc queries) |