How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Ingo U Your Own Question
Ingo U
Ingo U, Software Engineer
Category: Programming
Satisfied Customers: 755
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
Type Your Programming Question Here...
Ingo U is online now
A new question is answered every 9 seconds

Ive seen that you wrote some vba in excel to control the 8

This answer was rated:

Hi mike.ive seen that you wrote some vba in excel to control the 8 data pins of the parallel port. im doing a project with my son and I am stuck! is it possible to pulse these pins of the parallel port, for example, cell I1 has say 230 wrote in it (or the binary of 230) and parallel port pin D0 pulses 230 times. if I1 then has 230 changed to 324 the pin of the parallel port then pulses another 324 times. theres slightly more but if you could help I would be greatfull for ever! Many thanks Mr Paul Lacey

Hello Paul,

not sure what post you're referring to; if it's Mike B's reply from 7 years ago, I'm not sure he's on this site anymore.

At any rate, there seem to be multiple ways to access the parallel port; have you already chosen and used one?
If so, and you're only looking for a way to create a timed loop to write a sequence of values to it (alternating 0 and 1 pattern to pulse, I'd presume)

here's a quick VBA macro to demonstrate a simple countdown loop:

It'll start looking at the value in I1, wait 100ms, decrement I1 by one, and repeat until I1=0. You would just have add code in that loop to perform the write operation to the parallel port
Let me know if that's helpful at all. If the actual I/O is also something you're looking for, I'd have to dig a bit deeper, I'm sure I could come up with a way.


Ingo U

Customer: replied 1 year ago.
Hi there.thanks for your reply. how do I get the number to start counting down. I typed in a different number but it remained steady. should the number count down until it displays 0. No, I don't know how to access the parallel port pins. im ok with in cell formula, but have never programmed VBA. Firstly I cant thank you enough for your help. ill outline what myself and my son are doing. with in cell formula, we have wrote a control for a cnc milling machine. the cells I1 to L1 display the number of counts that need to be accessed and appear on the first four data pins of the parallel port, which is why we need the pins to pulse to control the drivers for the stepper motors. once the numbers have counted down with the corresponding pins pulsed equal to the number in the cell(s), and assuming the numbers in the cells I1:L1 show a zero when the count has finished, I can use the zeros displayed to increament our vlookup table to show a new set of numbers in cells I1:L1. our vlookup displays numbers in cells i1:L1 that come from four columns which make up the movement of the stepper motors. I hope this doesn't sound confusing! i also need the remaining four data pins of the parallel port to reflect if there is a 0 or 1 in cells M1:P1. for example, if there is a 1 in cell O1 the corresponding port pin will be high, if O1 has a 0 the port pin is low. also, what determines the clock rate? would this be able to be selected with a number in a cell. for example ,enter 100 in a chosen cell and the clock rate for say I1 will be 100ms, enter 200 and the clock rate will be 200ms so i could select different clock rates for cells I1:L1.
i know this may be a tall order but i truly sense that you can achieve this. with regard to the fee, im ok with what ever you decide it needs to be as this is quite a lot of work im sure. you can speak to me on 07900 191 436 if this is allowed.
Many, many thanks.....paul

Hi Paul,

sounds like a fun project! Just quickly here, in the sheet I gave you, when you click the "start" button next to I1, it should decrement whatever number is ***** I1 before your eyes, one count every 100ms, until it reaches 0. Then you can enter another positive number, click "start" again and it'll start over. It's a very short vba program, have you had a chance to look at the code?

Note that since it's a macro-enabled (i.e. containing vba code) workbook, you'll probably get a security warning when you open it and have to allow it to run the vba content for this all to work, of course.

But I see the bigger issue will be accessing the parallel port. I'll have to do a little R&D on that. What kind of PC and OS version are you running on?



Customer: replied 1 year ago.
Hi sorry for the delay in replying. its windows 7 home premium and 64bit. when I opened up the excel sheet that was posted there was no start button!? just quick point, because the numbers that will appear in cellsi1:l1 will be cells that have a formula in which take numbers via the vlookup table, I would think that the vba will need to repeat these numbers in say I2:L2 thus leaving the formula's in I1:L1. also, what determines the upper clock rate?...Many thanks....Paul

I'm so sorry, I sent the wrong link to the non-macro version of the file (totally useless) Let's try again:

We'll figure out the proper logic to leave the formulas intact and have the "action" use their values at runtime.

Althought the theoretical upper clock rate in this environment would be 1kHz, as the delay through the loop is specified in an integer value of milliseconds,

in reality it is probably 64Hz, as that is the resolution of the standard windows OS timer (15.6ms)

If you really need something faster, we'd probably have to leave the Excel environment and get more involved.

Customer: replied 1 year ago.
Hi. great, it works!. Didn't work first time as some of my macro setting were disabled! I love the idea of using Excel so yes, 64Hz will be ok.

Hi Paul,

I'm sorry for the delay; as it turns out my computer's parallel port expansion card doesn't work since my Windows 10 upgrade; so I don't have an easy platform to work this out at the moment. I hope to be able to dust off an older box this weekend and give it a try. However, if you've lost patience and have moved on, please let me know; I'd understand.



Hi Paul,

Good news! I was able to get my old computer running and figured out how to control the data bits on the parallel port from Excel - I was able to generate a square wave on D0, it was a frequency of 32Hz since the the bit has to be on for 15.6mS and then Off for another 15.6 ms for a complete cycle.

This experiment is here:

You will have to install the inpout32.dll that is here:

I found this here:

I just ran the InstallDriver.exe in the WIn32 folder - note that even though you're on 64-bit Windows, I'm pretty sure Excel still runs as a 32bit application, so installing the 32bit dll should be all you need.

Please have a look and maybe try to run the code on your machine, see if you get a square wave on D0 (pin 2 on the DB25 connector) for a couple of seconds when you run the test() macro from the VBA editor window.

Let me know how it goes and if you want to proceed further...


Ingo U

Customer: replied 1 year ago.
Hi. I had trouble installing the driver from the win32 folder but my computer seemed to adjust its settings to install it. but when I run the macro it fails. so clicking the debug shows error at line Call Out32(dataPort, &H1). this is an area that I don't understand as im only just understanding VBA! im wondering if the driver in stalled properly?, or if the 32bit doesn't like my 64bit system,, at this stage I really don't have a clue. I have managed to achieve my programme to work ok. it clocks down 4 cells with numbers in, each cell having different lengths of number and they all reach zero at the same time and then the vlookup table increaments down to the next row of numbers which are then clocked down. the vlookup table works its way through the table of numbers till it reaches the end at which point it stops running. I have a onscreen button which resets the table to the beginning and a button that starts the process all over again. wont tell you how long that took! I will say that when I started to work with the VBA etc my daughter had gone away for the weekend and by the time I had got my programm running, she had been back 2 days!, oh well! anyway, its defiantly getting closer. ill await your reply...Paul
Customer: replied 1 year ago.
Hi just a quick note. in my program, because I could not run 4 macros together, I have one macro clocking down the first cell and the other 3 cells clock down by the correct amount with in cell formula. this works fine but with regard to the last macro you posted which will access a data pin, how do you think the other 3 cells with there numbers clocking down will pulse there respective pins as it seems that all pins will need to be accessed by a macro. maybe ill need a macro that not only clocks the first cell down ( which has the biggest number in as that needed to be clocked the fastest ) but also looks at the remaining 3 cell in sequence to see if the number have changed and if so clocks the pin for that sell? I really am confused now! but ill cross that come the time. first thing is to get the last macro you posted to clock a pin. also with the macro you sent, with the for next loop what does the 2 sleep 20ms do in relation to the clock pulse?..many thanks...Paul
Customer: replied 1 year ago.
Hi yes of course, please help as at this point I am stuck as I don't know how to get the macro to run and pulse the pin.
many thanks...paul

Hi Paul,

seems like we're in some choppy waters with the 64-bit OS and somewhat older libraries.
I have tried running the excel file I gave you on a 64bit machine and get the same(?) error - inpout32 not found

I tried a couple of things but finally it stopped giving me this error when I copied the file


found in the original Win32 folder I gave you, to the folder


Give that a try! ... and let me know what happens. If the excel macro runs without errors, check your output pin to see if it's in fact pulsing while the macro runs.

Once we get past this hurdle, I'll look into your other issues...


Ingo U and other Programming Specialists are ready to help you
Customer: replied 12 months ago.
Hi, well, I did what you asked and sure enough the macro ran. so I went to check output on the parallel port and guess parallel port!. what had happened was that I had a older computer that was identical in looks to the one I have here which had a parallel port but I gave that one to my eldest son!. no more to do, I spoke to him and he was not using it so got the computer, loaded it all (as its also 64bit windows 7 with 2007 excel) and run the macro again, and it still ran. when I checked the pin 2...Ha..presto..we had a pulse! only 16Hz as im assuming that's becase of the 2 20ms in the macro. didn't check as I was in a rushbut sure if I put 2 10ms it will give me 32Hz. I have been thinking about clocking the remaining pins and im pretty sure I know what to do. so at the moment what I need to know is the remaining Out32(dataPort, &H1) codes (is it hex?) for the remaining 7 pins. if you could post them on this site for me highlighting which one does what that will be great.
once I have those I think I will be fine. of course, if I get stuck I will get back to you. please let me know what your final fee will be as I will make sure that there is enough money in that account as I only top that account up for shopping etc.
You have been a great help and responded fat to my problems and I thank you for that....Paul
Customer: replied 12 months ago.
sorry for the word FAT! I meant fast!......

Hi Paul,
yes, sadly there's no amount of software tinkering that will overcome a missing hardware component :-) Glad to hear you got it to work, and thank you for the payment and added bonus, and you don't owe me any more for the effort so far (and including the remarks below)

Oddly it wouldn't let me post the text I had written "below", so here it is in a separate document for you to read:


Customer: replied 12 months ago.
Hi thanks for the response. Yes, if I have any further questions I will name it for you. so very pleased with your help.
have a great weekend...Paul