loop not looping

User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

loop not looping

Post by stuck »

I have code that I know works as expected. It lives in a global template and users run it by clicking a custom button in a custom section of the Home tab on the Ribbon. At least nine users use this feature regularly without any problems. On those machines the code runs and as expected, i.e. it ends by asking you if you want to start again or if you want to stop.

You can here the BUT coming, can't you?

BUT it does not do that on one user's machine. On that machine the code runs and just stops. There are no error messages and it does not ask the rerun/stop? question.

I have checked numerous settings in Office and, as far a I can see, this problem machine is setup in exactly the same way as all our other machines. Does anybody have any suggestions as to what this user might have done/tweaked within Word / Word's VBE to make the code not run properly?

Thanks,

Ken

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: loop not looping

Post by StuartR »

It's hard to guess without seeing the code. Did you try single stepping it to see what happens?
StuartR


User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: loop not looping

Post by stuck »

The code runs correctly on every other machine and because it's in a global template users cannot even view the code so I don't think the code is the problem. However, users can open the VBE and the owner of the problem machine is the only person in the team (other than me) not to be afraid of opening the VBE. That's why I'm wondering if the user has changed something. The user is not owning up to making any changes...

Ken

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: loop not looping

Post by ChrisGreaves »

stuck wrote:
04 Dec 2020, 09:52
...wondering if the user has changed something. The user is not owning up to making any changes...
Hi Ken; stories like this make me glad that I am retired!

By "... user has changed something ..." I take it that you mean that the user has not changed anything in your template, but might have changed something in some other template?

A simple example: If you were using that one-off On Time construct in your Word template, everything would be fine, but if a rogue user ("ChrisGreaves") wrote his/her own VBA code and used On Time, then there would be a conflict.

Is that the type of scenario?

A different test would be for you to password-protect/lock the global template and re-release it and see if the problem remains (confirmation that the rogue user's environment was different).

The Chris Greaves of this world, once they open the Pandora's Box, are a force to be reckoned with.
There are no error messages and it does not ask the rerun/stop? question.
On a basic level, is it possible to put a break-point in the form of a Stop statement just before each critical point? Or else log (to a text file) the passage of control through those vital bits of code?

We can leave the question of "What else in your code is being bypassed" besides the obvious user-messages, to another date.(1)

(1)If your colleague works in a financial department, you might casually ask for bank-produced printouts of personal bank statements :evilgrin:

Cheers
Chris
An expensive day out: Wallet and Grimace

User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: loop not looping

Post by stuck »

Hi Chris,

Thanks, things to think about in there. I'll give a full answer later but that might not be until Monday now.

Ken

User avatar
Jay Freedman
Microsoft MVP
Posts: 1313
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: loop not looping

Post by Jay Freedman »

Another path to examine: Is there any possible interaction between the code and the content of the active document that could cause a stop? Investigate whether the document contains some character(s), especially the nonprinting ones that are visible only when you turn on the ¶ button, that could be "fatal" data for the macro.

PJ_in_FL
5StarLounger
Posts: 1090
Joined: 21 Jan 2011, 16:51
Location: Florida

Re: loop not looping

Post by PJ_in_FL »

Any references set or required that are not set, or is there a code dependence on early vs late binding?
PJ in (usually sunny) FL

User avatar
kdock
5StarLounger
Posts: 720
Joined: 21 Aug 2011, 21:01
Location: The beautiful hills of Western North Carolina

Re: loop not looping

Post by kdock »

Ken, your description of the issue implies that the routine in question has successfully run on The Tenth Machine ("TTM") in the past and has only stopped working recently. Is that true?

Is the global template on a network drive or has it been downloaded to each machine?
Have you checked to make sure there are no temp files lurking about on TTM? Temp files can flummox Word in peculiar ways. If the machine crashed, temp files of any global templates might be lingering and interfering.

Kim
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.

User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: loop not looping

Post by stuck »

Thank you everybody!
Jay Freedman wrote:
04 Dec 2020, 22:03
...Investigate whether the document contains some character(s)...
That's an easy one. The same document + macro combination works as expected on everybody's machine except this one, i.e. document content is not the problem.
PJ_in_FL wrote:
05 Dec 2020, 01:00
Any references set or required that are not set, or is there a code dependence on early vs late binding?
The problem machine has the same references set as the all the OK ones. As for early / late binding. My code is ugly, it is not optimal by any stretch of the imagination but it works on all the other machines.
kdock wrote:
05 Dec 2020, 20:43
...your description of the issue implies that the routine in question has successfully run on The Tenth Machine ("TTM") in the past and has only stopped working recently. Is that true?
Yes, which is why I think the root of this problem is something that the user has done to the machine (but they are not admitting to anything).
kdock wrote:
05 Dec 2020, 20:43
Is the global template on a network drive
Yes, and all the OK machines access it and run it correctly. The problem machine must also be able to access it, otherwise it wouldn't even partially run. it
or has it been downloaded to each machine?
kdock wrote:
05 Dec 2020, 20:43
Have you checked to make sure there are no temp files lurking ...
I've not looked for lurking temp files but I will now.

I've not forgotten Chris's ideas either. I'm hoping to have another poke at this problem later today. I'll report back in due course.

Ken

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: loop not looping

Post by ChrisGreaves »

stuck wrote:
07 Dec 2020, 08:31
I've not forgotten Chris's ideas either. I'm hoping to have another poke at this problem later today. I'll report back in due course.
Hello Ken.
Your first big mistake was leaving This Giant Brain all weekend to come up with yet-another-idea. :grin:

Set up a an eleventh machine equipped to run your template; test it out in the secrecy of your own plain brown-paper envelope, and then while your colleague is out having elevenses, swap the two machines.
In theory the eleventh machine is a stripped-down version of your colleague's machine; it merely lacks the statistics file on Solitaire and other non-standard stuff.

If the 11th machine does NOT work, then the problem is probably somewhere along the network pipeline?
If the 11th machine DOES work, then measure the possibility of pre-loading it with colleagues essential software and repeating the test.

If the 11th machine does NOT work, then the problem is probably somewhere in the essential other-software.
If the 11th machine DOES work, then the problem is probably somewhere in the non-essential other-software OR something to do with a Windows table or file overflowing/corruption?

I recognize that this is just a top-down binary-chop approach, and I am sure that by now you have a piece of paper (with the equivalent felt-pen diagrams scrawled on it) pinned to the wall of your cubicle ...

P.S. In lieu of an eleventh machine you could try just swapping (as in physically lugging) colleague's machine with some other machine, basically un-plug and re-plug, as we used to do back in the day when we had real micro-computers at each desk.
Cheers
Chris
An expensive day out: Wallet and Grimace

User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: loop not looping

Post by stuck »

The difficulty with swapping machines around is that we are not in the same office, we're not even in the same building. We are all working from our own homes, across the company's VPN.

And before any one says, "Oh, why didn't you mention that extra bit of complexity earlier?", I refer you to my previous statement that it's only this one machine that's not behaving as it should. Despite the variety of Internet connections we are working across, it woks for all except one.

Ken

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: loop not looping

Post by ChrisGreaves »

stuck wrote:
07 Dec 2020, 16:34
The difficulty with swapping machines around is ...
Fair enough.
(falls back to distant defence line and re-strings his bow)
One last try: If the company is so rich :grin: then the next time they buy a computer, kit it out with the corporate software, test it, and ship it to the colleague.
Make them test your template before they make any changes.
If they then load the fascinating war-game "sex goddess of the midnight vampires" and subsequently complain that your template is failing, you at least have an idea.

I did a contract for a large pharmaceutical that, when I re-booted the computer each morning (this was an Excel VBA project after all!), the old machine reloaded the C: image across the LAN. I timed it the first few times - 45 minutes to reboot. (Well, 43 minutes to LAN-copy the image and two minutes to boot, but you get the idea).

Another fall-back:
something else stops working, and only on this machine.
Another fall-back: "everybody's" machine has to be submitted for a refreshed system image, starting with your colleague's machine.

These and other similar suggestions seem to be expensive to the bean-counters, but compared to the cost of having you spend hours trying to find out, the cost is trivial.
And yes, it is very easy for me, "Retired old guy of Bonavista" to spend other people's money.

I love this thread; it's like one of those ten-minute serials they used to show Friday nights before the main picture.

Cheers
Chris
An expensive day out: Wallet and Grimace

User avatar
DaveA
GoldLounger
Posts: 2599
Joined: 24 Jan 2010, 15:26
Location: Olympia, WA

Re: loop not looping

Post by DaveA »

We are all working from our own homes, across the company's VPN.
Are the users using company provided machines or are using their own?

If not company owned machines, what versions of the OS and Office compared to the versions of the working machines?
What AV and other protection programs are running on this machine?
I am so far behind, I think I am First :evilgrin:
Genealogy....confusing the dead and annoying the living

User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: loop not looping

Post by stuck »

DaveA wrote:
07 Dec 2020, 17:09
...Are the users using company provided machines or are using their own...
Everybody is using the same company provided hardware (Dell Latitude laptop) with the same company-wide OS and application image, a common OS, AV and Office apps365. They all update regularly via WSUS. Plus all out team have a common set of tweaks applied to their Office profile, to ensure they default to our templates. This again is why I suspect the problem is a user initiated change to something within Office / Office VBE on the problem machine.

Ken

User avatar
DaveA
GoldLounger
Posts: 2599
Joined: 24 Jan 2010, 15:26
Location: Olympia, WA

Re: loop not looping

Post by DaveA »

Then I would say that it is time to have a house call and visit this machine on site!
I am so far behind, I think I am First :evilgrin:
Genealogy....confusing the dead and annoying the living

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: loop not looping

Post by ChrisGreaves »

DaveA wrote:
08 Dec 2020, 16:36
Then I would say that it is time to have a house call and visit this machine on site!
When I was in business I made use of, and asked clients to install, a tiny-footprint program that let us operate each others computers.
I forget the name and seem to have wiped it off my machine.

I recall that it was dead-simple to use. My client could d/l and install it in about 60 seconds, then, somehow, my client and I hooked up (with a key word, I think), and voila! I could operate my client's Windows system as if I were sitting deskside (and vice-versa, if I recall correctly).

Someone here still uses it, I bet, and at the mention of the name I shall shriek "that's it".

That was a time saver deluxe for us, because I could tweak, or demonstrate, some feature in ten minutes, for a client in another city.

I know this is vague, but Ken, is that not a possibility, for you to single-step through the code remotely?

Cheers
Chris
An expensive day out: Wallet and Grimace

User avatar
Leif
Administrator
Posts: 7193
Joined: 15 Jan 2010, 22:52
Location: Middle of England

Re: loop not looping

Post by Leif »

DaveA wrote:
08 Dec 2020, 16:36
Then I would say that it is time to have a house call and visit this machine on site!
Ummm, Dave... We have something called Covid-19 doing the rounds in this country. This may be why some folk are working from home...
Leif

User avatar
DaveA
GoldLounger
Posts: 2599
Joined: 24 Jan 2010, 15:26
Location: Olympia, WA

Re: loop not looping

Post by DaveA »

Well we do to, but some things just need to be addressed.
Service calls and deliveries are made every day.
I am so far behind, I think I am First :evilgrin:
Genealogy....confusing the dead and annoying the living

User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: loop not looping

Post by stuck »

DaveA wrote:
09 Dec 2020, 01:31
Well we do to, but some things just need to be addressed.
Service calls and deliveries are made every day.
I am not allowed to make a house call. Strictly speaking I'm not even allowed to walk to the pub on the road out of the village but that's a far to political story for this forum :smile:

Ken

User avatar
stuck
Panoramic Lounger
Posts: 8127
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: loop not looping

Post by stuck »

ChrisGreaves wrote:
08 Dec 2020, 16:45
...a possibility, for you to single-step through the code remotely?...
That approach is on the 'to do' list. MS Teams allows me to both see and control a remote PC. Seeing Is OK but controlling is a bit like stirring concrete.

Ken