Solved

VB6 Activex exe

Posted on 2004-09-24
4
280 Views
Last Modified: 2013-12-26
Hello, I have an active x exe made in vb6.

which does this:

Sub Test

for i = 1 to 10
   sleep (2000) 'pause for 2 seconds
   msgbox cstr(i)
next i

End Sub


I register this exe and add reference to it in ms excel.

I then reference the object using the CreateObject syntax and run the procedure 'Test'

I thought that being an exe, while this runs in excel, i will be still able to type in the cells (i.e. I thought that being an exe, it would run in its own memory space...)  but i have to wait for the whole procedure from the exe to finish before i can do anything in excel.

How can I have the workbook multitasking, i.e typing in cells while this exe runs the procedure..?

Thanks
0
Comment
Question by:sublimation
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
You have to use timecontrol


ie

from your method

timer1.interval = 2000
timer1.enabled = true


In
 Private Sub Timer1_Timer()
static i as integer

i = i + 1
if (i< 10 ) then msgbox cstr(i)


End Sub




etc
0
 
LVL 4

Author Comment

by:sublimation
Comment Utility
Hi,  EDDYKT

I dont understand why i have to use the time control, if the activex was querying a database (so had no need for any timer control) and the query took 1 minute, im still not able to click into the excel cell while this is running.  So it seems to have nothing to do with the timer control.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 500 total points
Comment Utility
Because you block on the call from excel. If you return your call from exe as soon as possible and do you job from the timer control, then you should be able to click on the cell. You can use call back to return the result back to excel
0
 
LVL 4

Author Comment

by:sublimation
Comment Utility
Ok, I will try this.  Thanks.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now