LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Embedded Excel macro runs 100X slower

Hi All,
I've bumped into an interesting situation. Upon creating and running a macro
(below) to programmtically change PPT-embedded Excel sheets, it runs MUCH
slower (~100x slower) than if I run the macro from pure Excel. I can only
think it has to do with bad Excel referencing (e.g.
support.microsoft.com/kb/178510/EN-US/), or... Also, Task Manager shows CPU
is ~98% Idle (no Excel CPU!!!) I have a feeling that the Replace method is
the problem, however I've tried all the tricks I know and nogo.
Thanks os much for your attention and help. Rgds, JS

=============================
Sub EmbeddedExcel_Replace_All_File2()
Dim Shp As Shape
Dim Sld As Slide
Dim xlApp As Excel.Application
Dim oWorkbook As Excel.Workbook
Dim oWorksheet As Excel.Worksheet
Dim SldNum As Long
tStart = Time
Set xlApp = New Excel.Application
For Each Sld In Application.ActivePresentation.Slides
For Each Shp In Sld.Shapes
If Shp.Type = msoEmbeddedOLEObject Then
If Shp.OLEFormat.ProgID = "Excel.Sheet.8" Then
Set oWorkbook = Shp.OLEFormat.Object
Set oWorksheet = oWorkbook.ActiveSheet
With xlApp
Open "C:\Documents and Settings\Administrator\Desktop\Macros\excel.txt"
For Input As #1
Do While Not EOF(1)
Input #1, sFirst, sLast
oWorksheet.Cells.Replace What:=sFirst, Replacement:=sLast,
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=True
Loop
Close #1
End With
oWorkbook.Close (True)
Set oWorkbook = Nothing
Set oWorksheet = Nothing
TimeF = Time
End If 'Shp.Type
End If 'Shp.OLEFormat.ProgID
Next Shp
Next Sld
tEnd = Time
MsgBox "Start=" & tStart & " | End=" & tEnd & " | Lap=" &
FormatDateTime(TimeValue(tEnd) - TimeValue(tStart))
xlApp.Quit
End Sub


 
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
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
macros making files slower and slower Raja Excel Discussion (Misc queries) 1 May 9th 08 12:26 AM
String manipulation in macro runs slower each time ran. Lamination Technology Excel Programming 6 March 16th 06 05:57 AM
Excel gets slower and slower.... Romuald[_3_] Excel Programming 3 July 7th 05 02:25 PM
Macro run much slower under VBA than in Excel Bin Excel Programming 0 July 25th 03 11:40 PM


All times are GMT +1. The time now is 09:31 AM.

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"