Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
strange com object behavior
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rodney Snell  
View profile  
 More options Jun 30, 4:47 pm
From: Rodney Snell <snells...@gmail.com>
Date: Tue, 30 Jun 2009 13:47:47 -0700 (PDT)
Local: Tues, Jun 30 2009 4:47 pm
Subject: strange com object behavior
I have an IronPython script that replaces some text in an Excel
spreadsheet.  Works great.  I just ported it to Boo (running with
booi) and I get an Excel error the *second* time through a loop that
is doing the modification.  Here is the Boo script:
------------------------------------
import System
import System.IO

def test():
        excel as duck = Activator.CreateInstance(Type.GetTypeFromProgID
('Excel.Application'))

        #First time through this loop, works great
        #Second time, Excel pops up a message on the wrange.Replace stating
that it cannot find any data to replace
        for i in range(0,2):
                fname = "d:\\work\\scripts\\test${i}.xlsx"
                if not File.Exists(fname):
                        File.Copy('template.xlsx', fname)

                wbook = excel.Workbooks.Open(fname)
                wsheet = wbook.ActiveSheet
                wrange = wsheet.UsedRange
                wrange.Replace('ENAME', 'joe')
                wbook.Save()

        excel.Quit()

test()
---------------------------------------

The IronPython script is exactly the same with appropriate minor
modifications.

Any idea why this is occurring?  Thanks in advance.  (I can post
sample excel files but for testing you can create a simple sheet with
a string 'ENAME' in one of the cells...)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cedric Vivier  
View profile  
 More options Jun 30, 11:39 pm
From: Cedric Vivier <cedr...@neonux.com>
Date: Wed, 1 Jul 2009 11:39:29 +0800
Local: Tues, Jun 30 2009 11:39 pm
Subject: Re: strange com object behavior

Hi,

On Wed, Jul 1, 2009 at 4:47 AM, Rodney Snell <snells...@gmail.com> wrote:
> (running with booi) and I get an Excel error the *second* time through a
> loop that
> is doing the modification.

Can you post details about the error you get?

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rodney Snell  
View profile  
 More options Jul 1, 1:04 pm
From: Rodney Snell <snells...@gmail.com>
Date: Wed, 1 Jul 2009 10:04:17 -0700 (PDT)
Local: Wed, Jul 1 2009 1:04 pm
Subject: Re: strange com object behavior
I have uploaded a zip file 'exceltest.zip'.  It contains a screenshot
of the error.  It also contains my script and a sample Excel
spreadsheet if you want to try and duplicate (you'll have to change
the hardcoded path to match your system).  Thanks for checking.

On Jun 30, 8:39 pm, Cedric Vivier <cedr...@neonux.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google