PC Review


Reply
Thread Tools Rate Thread

Altering an open excel document

 
 
umop
Guest
Posts: n/a
 
      7th May 2007
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 With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      8th May 2007
Maybe try using GetObject .

NickHK

"umop" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Altering the Doc properties from inside a document Mumbly_Joe Microsoft Word Document Management 5 21st May 2010 04:12 PM
Move a page within a document without altering rest of data? tjsmags Microsoft Word Document Management 2 18th Sep 2008 05:01 PM
Open an Excel document in 2007 document using the 2003 office =?Utf-8?B?UGV0ZXI=?= Microsoft Excel Programming 1 23rd Oct 2006 06:41 PM
Reading/altering an .xml document Bob Robertson Microsoft C# .NET 1 4th Sep 2004 06:09 PM
Reading/altering an .xml document Bob Robertson Microsoft Dot NET Framework 1 4th Sep 2004 06:09 PM


Features
 

Advertising
 

Newsgroups
 


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