To GetObject or Not to GetObject 
Author Message
 To GetObject or Not to GetObject

My question is about whether GetObject will improve my current Word
Macro.

OK long setup story.

I compile data from a mainframe terminal into a ASCII file that I then
import into Excel.  I perform the Subtotals on the whole range.  This
gives my the 50 totals in three columns that I'm after.

From the Word doc/macro, I simply load the Excel sheet, which Word
happily converts to a new document and table.  I then search through
the imported table looking the "### Total" label. I copy the three
totals from the imported table and then paste those totals into my
Word document table.

The whole process of importing, searching, then pasting takes about 1
minute to run.

Would I gain anything by using the GetObject and grab the data from
Excel?

Thanks!

David



Wed, 30 Jun 2004 05:23:23 GMT  
 To GetObject or Not to GetObject
Assuming it takes you two hours to make the change, that's 120 minutes you
need to recover. If the current method takes only one minute, there's no a
huge scope for saving, but be optimistic -- you'll maybe save 15 seconds per
run following this 'upgrade'. So if you are expecting to run this code more
than 480 times, the answer is yes.

One advantage of pulling the data directly from Excel would be that you can
adapt more quickly when the format of the data in the mainframe changes. Is
that likely? (In my experience, inevitable...)


Quote:
> My question is about whether GetObject will improve my current Word
> Macro.

> OK long setup story.

> I compile data from a mainframe terminal into a ASCII file that I then
> import into Excel.  I perform the Subtotals on the whole range.  This
> gives my the 50 totals in three columns that I'm after.

> From the Word doc/macro, I simply load the Excel sheet, which Word
> happily converts to a new document and table.  I then search through
> the imported table looking the "### Total" label. I copy the three
> totals from the imported table and then paste those totals into my
> Word document table.

> The whole process of importing, searching, then pasting takes about 1
> minute to run.

> Would I gain anything by using the GetObject and grab the data from
> Excel?

> Thanks!

> David



Wed, 30 Jun 2004 05:57:31 GMT  
 To GetObject or Not to GetObject
Hi David,

It sounds like your macro might be doing a lot of unneeded work in Word. How
are you going about inserting this information from Excel? Are you Inserting
the File? If so, you might want to investigate Inserting it as a Database
with a Query (Word makes automating this easy; start by recording your
macro). You can insert the entire worksheet from excel or you can insert
only a named ranged (that is, if you have named the range in Excel). This is
very quick and might be faster than cycling through a Word table.

HTH


Quote:
> My question is about whether GetObject will improve my current Word
> Macro.

> OK long setup story.

> I compile data from a mainframe terminal into a ASCII file that I then
> import into Excel.  I perform the Subtotals on the whole range.  This
> gives my the 50 totals in three columns that I'm after.

> From the Word doc/macro, I simply load the Excel sheet, which Word
> happily converts to a new document and table.  I then search through
> the imported table looking the "### Total" label. I copy the three
> totals from the imported table and then paste those totals into my
> Word document table.

> The whole process of importing, searching, then pasting takes about 1
> minute to run.

> Would I gain anything by using the GetObject and grab the data from
> Excel?

> Thanks!

> David



Fri, 02 Jul 2004 21:54:17 GMT  
 To GetObject or Not to GetObject
Quote:

> One advantage of pulling the data directly from Excel would be that you can
> adapt more quickly when the format of the data in the mainframe changes. Is
> that likely? (In my experience, inevitable...)

I see your point.  Maybe a rainy day project. (I would like to learn
more about the getobject function.)

Since I contol the output from the mainframe, (yet another macro I've
written to collect information.) a change is not likely to effect the
data format.

Thanks for the thoughts!

David



Fri, 02 Jul 2004 22:26:37 GMT  
 To GetObject or Not to GetObject

Quote:
> Hi David,

> It sounds like your macro might be doing a lot of unneeded work in Word.

I'll say!

Quote:
> How are you going about inserting this information from Excel?
> Are you Inserting the File?

No. Since the data in Excel doesn't always match the Word Table
exactly, I search for the Equipment ID in Col1 of Excel, grab the
totals, and search the Word Table Equipment ID and insert it.

In my first attempt I was using the Excel search to look for the
EquipID, (from Word.  I couldn't really get it to work)  After a
little seperation time, I think I should grab the whole Excel range,
and let Word search the range instead.  OR make a query as you suggest
and search the query object.



Mon, 05 Jul 2004 01:59:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. GetObject not working

2. GetObject() not telling me when the COM application is already running

3. GetObject not working

4. GetObject not working

5. GetObject not working

6. GetObject() not making word window active

7. getobject does not work in vbscript

8. ADSI:GetObject network path not found reading info other than the current computer name

9. GetObject fails in one case and not another

10. GetObject() not the same as GetActiveObject() ?

11. Win 3.1 API "getObject" conflict w/ OLE "getObject"

12. CreateObject vs. GetObject

 

 
Powered by phpBB® Forum Software