Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Macro slowing down after a while...

Hi!

I have a macro that runs a across 1000 records or more
and makes PDF´s of all the records.

The problem is that the macros slows down after it
processes the first 400 records. Why is this hapennig? do
i have do empty some Windows Temp file??

Thanks a lot!
SpeeD72
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro slowing down after a while...

It would be hard to tell since we have no idea what your code is doing or
how it is doing it.

--
Regards,
Tom Ogilvy


SpeeD72 wrote in message
...
Hi!

I have a macro that runs a across 1000 records or more
and makes PDF´s of all the records.

The problem is that the macros slows down after it
processes the first 400 records. Why is this hapennig? do
i have do empty some Windows Temp file??

Thanks a lot!
SpeeD72


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro slowing down after a while...

The code is kind of extensive! But i´ll try to post it
here with coments!

Sheet "base da Dados" has the Database (information)

sheet "Graf" has the information of row 2(formated and
ready to make a pdf)

I hope it helps

SpeeD


´ if there is information in the row all the procedure
begins if not the macro ends...

Do While Worksheets("Base Dados").Range("A2").Value
< ""

Application.ScreenUpdating = False
Sheets("Graf").Select
For x = 1 To Worksheets("Graf").Range("A3").Value
If Range(Range("A1").Value & x).Value = "" Or
Range(Range("A1").Value & x).Value = 0 Then
Rows(x).EntireRow.Hidden = True
End If
Next x

' Processo to prnt to PDF

Sheets("Graf").Select
Range("B3").Select

' 1as 2 linhas do Dim

PSFileName = ThisWorkbook.Path & "\" & "Temp
PS" & "\" & "myPostScript.ps"
If Range("A2").Value < "" Then
PDFFileName = ThisWorkbook.Path & "\" &
Worksheets("Opções").Range("C5").Value & "\" & Worksheets
("Opções").Range("C5").Value & "-" & Range("A2").Value
& ".pdf"
End If


' Print the Excel range to the postscript file

' 3a 2 linhas do Dim
Set MySheet = ActiveSheet
ActiveSheet.PrintOut copies:=1,
preview:=False, _
ActivePrinter:="Acrobat Distiller",
printtofile:=True, _
collate:=True, prtofilename:=PSFileName

' Convert the postscript file to .pdf

' 4a e 5ª 2 linhas do Dim

myPDF.FileToPDF PSFileName, PDFFileName, ""

Kill (PSFileName)

´Delete the current record and switch = to . to prevent
#REF in sheet graf


Rows("1:50").Select
Selection.EntireRow.Hidden = False
Sheets("Graf").Select
Cells.Replace What:="=", Replacement:=".",
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False,
SearchFormat:=False, ReplaceFormat:=False
Sheets("Base Dados").Select
Do While Range("A2").Value = Range("A3").Value
Rows("3:3").Select
Selection.Delete Shift:=xlUp
Loop
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Sheets("Graf").Select
Cells.Replace What:=".", Replacement:="=",
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False,
SearchFormat:=False, ReplaceFormat:=False


Sheets("Opções").Select
Application.ScreenUpdating = True

' Refresh the PDF´s counter cell in the opçoes sheet

Set fs = Application.FileSearch
With fs
.LookIn = ThisWorkbook.Path & "\" & Range
("C5").Value
.SearchSubFolders = True
.FileName = "*.PDF"
If .Execute() 0 Then
Range("B16").Value = .FoundFiles.Count
End If
End With

Loop




-----Original Message-----
It would be hard to tell since we have no idea what your

code is doing or
how it is doing it.

--
Regards,
Tom Ogilvy


SpeeD72 wrote in message
...
Hi!

I have a macro that runs a across 1000 records or more
and makes PDF´s of all the records.

The problem is that the macros slows down after it
processes the first 400 records. Why is this hapennig? do
i have do empty some Windows Temp file??

Thanks a lot!
SpeeD72


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro slowing down after a while...

The suspect part is the print and conversion.
I would comment out the print and conversion parts and run the macro - if
you don't see a slowdown, then you can assume it is in the print.

I would then comment out just the conversion and see if the there is a
slowdown with just the print.

If so, and there is a good chance there will be, then you might need to only
print 400 records at a time, then save and close the workbook/excel, then
print the next 400.

--
Regards,
Tom Ogilvy

SpeeD wrote in message
...
The code is kind of extensive! But i´ll try to post it
here with coments!

Sheet "base da Dados" has the Database (information)

sheet "Graf" has the information of row 2(formated and
ready to make a pdf)

I hope it helps

SpeeD


´ if there is information in the row all the procedure
begins if not the macro ends...

Do While Worksheets("Base Dados").Range("A2").Value
< ""

Application.ScreenUpdating = False
Sheets("Graf").Select
For x = 1 To Worksheets("Graf").Range("A3").Value
If Range(Range("A1").Value & x).Value = "" Or
Range(Range("A1").Value & x).Value = 0 Then
Rows(x).EntireRow.Hidden = True
End If
Next x

' Processo to prnt to PDF

Sheets("Graf").Select
Range("B3").Select

' 1as 2 linhas do Dim

PSFileName = ThisWorkbook.Path & "\" & "Temp
PS" & "\" & "myPostScript.ps"
If Range("A2").Value < "" Then
PDFFileName = ThisWorkbook.Path & "\" &
Worksheets("Opções").Range("C5").Value & "\" & Worksheets
("Opções").Range("C5").Value & "-" & Range("A2").Value
& ".pdf"
End If


' Print the Excel range to the postscript file

' 3a 2 linhas do Dim
Set MySheet = ActiveSheet
ActiveSheet.PrintOut copies:=1,
preview:=False, _
ActivePrinter:="Acrobat Distiller",
printtofile:=True, _
collate:=True, prtofilename:=PSFileName

' Convert the postscript file to .pdf

' 4a e 5ª 2 linhas do Dim

myPDF.FileToPDF PSFileName, PDFFileName, ""

Kill (PSFileName)

´Delete the current record and switch = to . to prevent
#REF in sheet graf


Rows("1:50").Select
Selection.EntireRow.Hidden = False
Sheets("Graf").Select
Cells.Replace What:="=", Replacement:=".",
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False,
SearchFormat:=False, ReplaceFormat:=False
Sheets("Base Dados").Select
Do While Range("A2").Value = Range("A3").Value
Rows("3:3").Select
Selection.Delete Shift:=xlUp
Loop
Rows("2:2").Select
Selection.Delete Shift:=xlUp
Sheets("Graf").Select
Cells.Replace What:=".", Replacement:="=",
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False,
SearchFormat:=False, ReplaceFormat:=False


Sheets("Opções").Select
Application.ScreenUpdating = True

' Refresh the PDF´s counter cell in the opçoes sheet

Set fs = Application.FileSearch
With fs
.LookIn = ThisWorkbook.Path & "\" & Range
("C5").Value
.SearchSubFolders = True
.FileName = "*.PDF"
If .Execute() 0 Then
Range("B16").Value = .FoundFiles.Count
End If
End With

Loop




-----Original Message-----
It would be hard to tell since we have no idea what your

code is doing or
how it is doing it.

--
Regards,
Tom Ogilvy


SpeeD72 wrote in message
...
Hi!

I have a macro that runs a across 1000 records or more
and makes PDF´s of all the records.

The problem is that the macros slows down after it
processes the first 400 records. Why is this hapennig? do
i have do empty some Windows Temp file??

Thanks a lot!
SpeeD72


.



Reply
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
excel 2003 slowing down Ron Excel Discussion (Misc queries) 0 October 19th 06 03:22 PM
slowing down nowfal Excel Discussion (Misc queries) 3 March 29th 06 01:33 AM
Slowing Macro Dick Kusleika Excel Programming 1 July 29th 03 07:01 PM
My macros are slowing down. Brad Patterson Excel Programming 0 July 24th 03 12:42 AM
My macros are slowing down. Brad Patterson Excel Programming 0 July 23rd 03 11:59 PM


All times are GMT +1. The time now is 05:10 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"