Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Does VBA support multi-thread?

I have a workbook with too many rows and columns of data. My macro run very
slowly. Can I use multithread in VBA? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Does VBA support multi-thread?

Unless you want to get into some seriously complicated programming (and a
lot of trouble) you can't.

RBS


"palo" wrote in message
...
I have a workbook with too many rows and columns of data. My macro run very
slowly. Can I use multithread in VBA? Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does VBA support multi-thread?


palo;127305 Wrote:
I have a workbook with too many rows and columns of data. My macro run
very
slowly. Can I use multithread in VBA? Thanks


How many Columns & rows are you using.

One thing that many users do that slows code down is to continually
Select and/or activate ranges. This is not usually necessary.

Also, check if your code contains Loops that could possibly be
unnecessary


--
royUK

Hope that helps, RoyUK
For tips & examples visit 'my web site' (http://www.excel-it.com/)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=35293

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Does VBA support multi-thread?

There are ways of speeding up the code. Post code if possible

Some tricks are to turn off screen up[dating and turn off events

Application.ScreenUpdating = False
Application.EnableEvents = False

If yu are deleting rows delete all the rows in one instruction rather than
one line at a time. I usually mark the rows I want to delete and then use
the mark to sort the rows I want to delete so the are all adjacent. There
are other tricks but without seeing the code I can't determine what is
slowing down your code.

"palo" wrote:

I have a workbook with too many rows and columns of data. My macro run very
slowly. Can I use multithread in VBA? Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Does VBA support multi-thread?

If VB6 support multithread, Can I to associate VB6 and VBA?

"RB Smissaert" wrote:

Unless you want to get into some seriously complicated programming (and a
lot of trouble) you can't.

RBS


"palo" wrote in message
...
I have a workbook with too many rows and columns of data. My macro run very
slowly. Can I use multithread in VBA? Thanks





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Does VBA support multi-thread?

Thank you very much. I want to get the information of multithread in VBA. Can
I do this with VB6?

"Joel" wrote:

There are ways of speeding up the code. Post code if possible

Some tricks are to turn off screen up[dating and turn off events

Application.ScreenUpdating = False
Application.EnableEvents = False

If yu are deleting rows delete all the rows in one instruction rather than
one line at a time. I usually mark the rows I want to delete and then use
the mark to sort the rows I want to delete so the are all adjacent. There
are other tricks but without seeing the code I can't determine what is
slowing down your code.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Does VBA support multi-thread?

I think you're on the wrong track in trying to get multithreading to work.
The reason for poor performance is in the code, not in the number of
processors used.

Post your code. I'm sure you'll get good advice on how to improve
performance.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"palo" wrote in message
...
Thank you very much. I want to get the information of multithread in VBA.
Can
I do this with VB6?

"Joel" wrote:

There are ways of speeding up the code. Post code if possible

Some tricks are to turn off screen up[dating and turn off events

Application.ScreenUpdating = False
Application.EnableEvents = False

If yu are deleting rows delete all the rows in one instruction rather
than
one line at a time. I usually mark the rows I want to delete and then
use
the mark to sort the rows I want to delete so the are all adjacent.
There
are other tricks but without seeing the code I can't determine what is
slowing down your code.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Does VBA support multi-thread?

I've never tried any of this myself, so I don't know how easy or hard it
might be, nor whether the principles can be extended to VBA or not, but here
is a link about implementing multithreading in VB5/6 from one of the most
credible authors of API techniques; perhaps you can make use of the material
he presents in it, but make sure to read the "Sequel #1- Regarding VB6"
section at the end of the article (actually, I think you should read it
first, before you get started)....

http://www.freevbcode.com/ShowCode.Asp?ID=1287

--
Rick (MVP - Excel)


"palo" wrote in message
...
Thank you very much. I want to get the information of multithread in VBA.
Can
I do this with VB6?

"Joel" wrote:

There are ways of speeding up the code. Post code if possible

Some tricks are to turn off screen up[dating and turn off events

Application.ScreenUpdating = False
Application.EnableEvents = False

If yu are deleting rows delete all the rows in one instruction rather
than
one line at a time. I usually mark the rows I want to delete and then
use
the mark to sort the rows I want to delete so the are all adjacent.
There
are other tricks but without seeing the code I can't determine what is
slowing down your code.



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Does VBA support multi-thread?

This is my code. The code run with 3000 file word in Foldername-folder:
Option Explicit
Sub GetDoc_Properties()
Dim FolderName As String, wbName As String
Dim rw As Integer
Dim lrow As Long, lrow2 As Long
Dim ObjWord As Object
Dim DoSubj As String, DoTit As String, DoAut As String
Dim sDate
On Error Resume Next
lrow = ActiveSheet.Range("B65000").End(xlUp).Row
ActiveSheet.Range("A9:G" & lrow + 9).ClearContents
FolderName = Cells(4, 5)
wbName = Dir(FolderName & "\" & "*.doc")
Application.ScreenUpdating = False
rw = 9
Set ObjWord = CreateObject("Word.Application")
While wbName < ""
With ObjWord
.Visible = True
.Documents.Open (FolderName & "\" & wbName)
DoSubj = .ActiveDocument.BuiltinDocumentProperties(2)
DoTit = .ActiveDocument.BuiltinDocumentProperties(1)
DoAut = .ActiveDocument.BuiltinDocumentProperties(3)
.Documents(wbName).Close
End With
Cells(rw, 1) = rw - 8
Cells(rw, 2).Value = DateSerial(2008, Mid(wbName, 4, 2), Mid(wbName, 1,
2))
Cells(rw, 3).Value = Mid(wbName, 7, Len(wbName) - 10)
Cells(rw, 4).Value = DoSubj
sDate = Split(DoTit, " ")
Cells(rw, 6).Value = DateSerial(sDate(2), sDate(1), sDate(0))
Cells(rw, 5).Value = DoAut
Cells(rw, 7).Value = Cells(rw, 6).Value - Cells(rw, 2).Value
rw = rw + 1
wbName = Dir
Wend
Cells(5, 5) = rw - 9
ObjWord.Quit
lrow2 = Range("B65000").End(xlUp).Row
Range("B9:H" & lrow2).Select
Selection.Sort Key1:=Range("B9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Cells(1, 1).Select
If rw = 9 Then
MsgBox "Duong dan hoac tap tin khong ton tai ", , "Thong bao"
End If
Application.ScreenUpdating = True
End Sub





"Joel" wrote:

There are ways of speeding up the code. Post code if possible

Some tricks are to turn off screen up[dating and turn off events

Application.ScreenUpdating = False
Application.EnableEvents = False

If yu are deleting rows delete all the rows in one instruction rather than
one line at a time. I usually mark the rows I want to delete and then use
the mark to sort the rows I want to delete so the are all adjacent. There
are other tricks but without seeing the code I can't determine what is
slowing down your code.


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Does VBA support multi-thread?

The Word application does not need to be visible while running the code.
Also, the "SaveChanges" option should be used for both the Close and
Quit statements... SaveChanges:=wdDoNotSaveChanges

However, your best bet may be to read the document properties
without opening the Word files using the Dsofile.dll from Microsoft.
See Chip Pearson's "Returning Property Values From a Closed File" here...
http://www.cpearson.com/excel/DocProp.aspx
and also...
http://support.microsoft.com/kb/224351/en-us
--
Jim Cone
Portland, Oregon USA


"palo"
wrote in message
This is my code. The code run with 3000 file word in Foldername-folder:
-snip-


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Does VBA support multi-thread?

Actually that should be... SaveChanges:=0
--
Jim Cone
Portland, Oregon USA


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
Multi thread in Excel Radhakrishna k.v.n.r[_2_] Excel Worksheet Functions 3 October 29th 07 05:07 AM
Does not support automation or does not support expected interface Maverick Excel Programming 0 September 21st 06 09:31 AM
Excel is multi thread program? maplemaple Excel Discussion (Misc queries) 0 January 13th 06 10:43 PM
Does excel support multi-value picklists? osu_kfrance Excel Worksheet Functions 1 December 29th 05 04:55 PM
How to thread Ernesto[_2_] Excel Programming 0 July 6th 04 07:40 PM


All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"