Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Code runs correctly on some computers but not others

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
headly - 10 Feb 2005 22:53 GMT
Creating code in Word 03 to run on XP computers. The code runs flawlessly on
some machines and errors out on others. Macro security aside, any ideas why
this would happen? Could it be the machines need service packs? Coherent
thoughts appreciated. Thx
Jay Freedman - 11 Feb 2005 03:05 GMT
>Creating code in Word 03 to run on XP computers. The code runs flawlessly on
>some machines and errors out on others. Macro security aside, any ideas why
>this would happen? Could it be the machines need service packs? Coherent
>thoughts appreciated. Thx

If you're using references to specific libraries, those files might
not be present on all the other computers.

On a computer where the code doesn't run, open the VBA editor and look
at Tools > References. If any of the checked items are marked as
missing, you need to install the necessary dll or ocx. You may also
need to run regsvr32 on the dll or ocx to register it.

--
Regards,
Jay Freedman
Microsoft Word MVP         FAQ: http://word.mvps.org
Jonathan West - 11 Feb 2005 15:22 GMT
In addition to Jay's answer, look at the following

-  if the macro looks up files in specific locations, are they in the same
place on all machines

- Are the settings the same in the Options dialog on all machines? For
instance, if the Save options include omitting featureslater than Word 97,
you will have trouble with nested tables and with text colors

The thing to do is to run the code on the various offending machines, and
see exactly where it breaks. If you can't go there yourself, produce what I
cann an "instrumented" version of your template that writes information to a
log file of where it has got to. Get the user to run the program and send
back the log.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> Creating code in Word 03 to run on XP computers. The code runs flawlessly
> on
> some machines and errors out on others. Macro security aside, any ideas
> why
> this would happen? Could it be the machines need service packs? Coherent
> thoughts appreciated. Thx
headly - 15 Feb 2005 01:41 GMT
So I wrote a simple on-exit forms procedure below. It ran fine on Office 11,
but hung on some Office 10 computers. When I saw the setup, I noted that the
problem computer had SP1 (rev 10.37xx) whereas the others did not have SP1
(rev 10.26xx). The Follow Up Question: If I write a packager/installer in
Vstudio, isn't it dangerous to overwrite someones dlls? If I write the code
in Office 9, would that avoid the issue? I'd love to know what MSFT thinks
about this one.

Sub TestEOS()

Dim varFieldResult As Variant
Dim intTableLine As Integer

On Error Resume Next

Call UnProtectDocument

Application.ScreenUpdating = False

varFieldResult =
ActiveDocument.Bookmarks("bkmHotelLodgeLine").Range.FormFields.Item("bkmHotelLodgeLine").Result

If varFieldResult = "End of Service" Or varFieldResult = "End of Services"
Or varFieldResult = "End Of Service" Or varFieldResult = "End Of Services" Or
varFieldResult = "end of service" Or varFieldResult = "End of service" Or
varFieldResult = "end of services" Or varFieldResult = "End of services" Then
   Selection.GoTo What:=wdGoToBookmark, Name:="bkmDatePrepP4"
End If

'Housekeeping/Cleanup
Call ProtectDocument
Application.ScreenUpdating = True

End Sub

> In addition to Jay's answer, look at the following
>
[quoted text clipped - 17 lines]
> > this would happen? Could it be the machines need service packs? Coherent
> > thoughts appreciated. Thx
Jonathan West - 15 Feb 2005 11:06 GMT
Hi headly,

You should not under any circumstances create an installer that updates
Office DLLs. Two reasons for this. First of all, you may well break the
user's copy of Office if the DLLs are not fully aligned, as they would be if
the copy is updated using a proper Service Pack. Second, you probably would
be in breach of license conditions to redistribute the individual DLLs.

The fact that the bad machine has SP1 installed is not *necessarily* the
cause of the problem. The existence of correlation does not mean that there
is definitely a causal relationship. As far as I can tell, you haven't yet
identified where in the code the hang occurs. Until you do that, you cannot
make more progress on identifying the cause. You will need to produce a
version of the macro that writes its progress to a log file so you can
pinpoint the exact line of code which causes the hang. Unless you do that,
and tell us which line it is, there is little more that anybody here will be
able to do to help.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> So I wrote a simple on-exit forms procedure below. It ran fine on Office
> 11,
[quoted text clipped - 63 lines]
>> > Coherent
>> > thoughts appreciated. Thx
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.