-
WSJamesB
AskWoody LoungerSee if the following helps:
WINUP-Problems When Viewing or Downloading From Windows Update -
WSJamesB
AskWoody LoungerYou might need to open a module or code, then select Tools-References.
Check the box for Microsoft Word Object Library (it will have a version #, depending on which you are using)
-
WSJamesB
AskWoody LoungerPeter,
I think next I would go ahead and try setting up your email again from Tools-Accounts in OE, putting in the real email server names, instead of the Norton Supplied ones.
This will tell you whether you have an email issue, or a Norton one.Remember, virus scanning for email will be disabled if you do this.
-
WSJamesB
AskWoody LoungerSee if the following document helps:
Error: “0x800ccc0e, Socket Error 10061” when using Outlook Express
-
WSJamesB
AskWoody LoungerCharlotte,
You are of course correct, I had completely missed being able to return an array inside a variant.ByRef can be very useful, in some situations. I think I suffer some semantics issues, since I tend to think of it more as modifying existing values, as opposed to truly returning a value (with some exceptions); and since it lends itself to abuse, I tend not to use it much, except in those situations where it is clearly warranted.
Thanks for pointing out the error in my previous message, I certainly don’t want to mislead anyone with my advice.
-
WSJamesB
AskWoody LoungerChris,
I think the issues of SUB vs FUNCTION, and the building of procedures in general are worthy of further discussion, and can help us all become better programmers. (Note: I will try to use “Procedure” to refer to either a sub or function, but the terms “sub” or “function” when I mean one of them explicitly).You have promoted two concepts in various threads, that I wish to respond to.
A Sub should never be used.
First, and I think you have pointed this out, a SUB is necessary when programming in the VBA environment, if you wish to expose your macros to the user.My personal opinion is to follow the convention that a Function returns a value, whereas a Sub does not. Most standard coding that you will read uses this convention. When you start to program subs as functions, returning essentially useless values from them, you make the calling procedure harder to read; you expose your code to more programming errors, and you lessen the portability of the sub that is now a function procedure. (for instance, you run the risk of moving it’s error checking into the calling procedure, as opposed to raising an error in the sub which is usually better). You stated that you challenge people to write a sub that cannot return a useful value, but I would say that in many instances, a sub (written as a function) can only return a value of whether it succeeded or failed, and in most of those cases, efficient error code in the sub is more appropriate than in the calling procedure. The exception sometimes being when the calling procedure must fail if the sub fails, but again, raising an error may be more approprite for handling this, since at best, a procedure failing because a sub function failed will never tell you why the sub function failed, only that it did, whereas a raised error can tell you that information.
A Function should only take in two values, and then return one value.
I strongly disagree with this statement, and feel it limits and unnecessarily complicates code. My definition of a function (or a sub for that matter), is it should perform one specific task, and it should perform it well. To arbitrarily limit these values to only two values in does not in my opinion constitute good coding practice, rather it limits the ability to code good, and can hinder instead of enhance the portability of your code. Example: (pseudo – coded)Function CompTrapezoidArea(aSide, bSide, Height) CompTrapezoidArea = 1/2(aSide + bSide) * Height End Function
Breaking the above into two functions would serve no purpose other than to unnecessarily involve an intermediate step.
I’ve enjoyed your code samples, and look forward to seeing more of them. I do think it is helpful for all to hear differing viewpoints on various coding styles and develop styles that work well for themselves, and the people who use there code.
-
WSJamesB
AskWoody Lounger -
WSJamesB
AskWoody LoungerI think it is worth pointing out that your function does NOT return more than one value; rather, it returns one value, but also sets some variables which can then be used by the calling procedure. This type of workaround opens up a whole host of potential problems, not the least of which is if error checking needs to be used. I must agree that you are much better off returning only one value from a function, and if two values are needed, many headaches can be avoided by using separate functions.
It is also worth mention that VBA does not have any way to return more than one value directly, although in VB 6 (not VBA), you can return an array which can often yield desired results. I have also seen other workarounds such as concatenating strings and breaking them apart; and other methods to get around this. But, as a very good general rule, you should look hard at your code, and determine if it can be broken down into separate procedures.
[indent]
I hold that it is a generally good programming practice (programming, not just programming-in-VBA) to write functions rather than subroutines, and to write functions that compose two incoming arguments into one outgoing result.
This is not always achievable, but when it is, it makes for more readable code, I maintain.
[/indent]
I also have some thoughts on this issue, but think they will be better served on their own thread, as opposed to bogging this one down. -
WSJamesB
AskWoody LoungerTools-Customize, Command Tab, click Keyboard Button, then select macro and key assignment.
-
WSJamesB
AskWoody LoungerThere are several ways, a lot depends on your setup.
Try this first:
In Control Panel, under “Users and Passwords:
1. On the Users tab, uncheck “Users must enter a username and password”2. On the Advanced tab, uncheck “Require users to press”
3. Click OK or Apply, and a window will popup where you enter the username & password of the account you want to automatically log on with.
You can also see: for other suggestions, as well as download TweakUI 1.33 (supports Win2k) and use that. Again, a lot depends on your specific user and/or security needs.
-
WSJamesB
AskWoody LoungerI’ve attached the code as a text file, to be sure it translated correctly to your machine.
Also, using a registry search is a sometimes “iffy” thing. Programs can get away with not having entries where they are supposed to.
It really depends on what program, and how it is entered in the registry. Some other keys that might have value (but should be tested thoroughly):
HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionUninstall
(add the name of the program from the Add/Remove Programs box)
in the function this would be:strAppExists = System.PrivateProfileString(“”, “HKEY_LOCAL_MACHINE _
& SoftwareMicrosoftWindowsCurrentVersionUninstall” & strAppName, “Display Name”)
‘(where strAppName is the name of the program from the Add/Remove Programs box)You can also try checking the program associated with the file extension.
To get the right key, look at:HKEY_CLASSES_ROOT.dwg
on the right, it should list the Default Value as something like dwgfilethen further down the reg key, look for:
HKEY_CLASSES_ROOTdwgfileshellopencommand
(replacing dwgfile with the actual name, if different)This will tell you what program is associated to opening this file type.
This may be some trial and error, to find where your program reference actually is. -
WSJamesB
AskWoody LoungerBAM,
Thanks, I never knew that was there, it seems quite helpful. One thing to note though is it runs up against one of the limitations I found when writing my macro, it misses hidden text, text boxes, and header / footer text. I guess it really depends on where you need the font info from.
-
WSJamesB
AskWoody LoungerDon,
Very nice piece of code. The only drawback I see is that a lot of users are disabling/renaming windows script, due to the proliferation of viruses that use it (Not taking a position either way on that issue). But, if present, that code works well.
With that in mind (and borrowing heavily from your concept), how about the following:
Function strAppExists(ByVal strAppName As String) strAppExists = System.PrivateProfileString("", "HKEY_LOCAL_MACHINESoftware" _ & "MicrosoftWindowsCurrentVersionApp Paths" & strAppName, "Path") End Function
Will return either the app path, or “” if not found. It could then be called by something similar to:
Function CheckApp() Dim strCheckApp, strAppName strAppName = "excel.exe" strCheckApp = strAppExists(strAppName) If strCheckApp = "" Then MsgBox UCase(strAppName) & " not found" Else MsgBox UCase(strAppName) & " found installed at " & strCheckApp End If End Function
-
WSJamesB
AskWoody LoungerThanks Gary, I did.
Sub ListFontsUsedinDoc() 'James Brooks February 2001 'Credit: Gary Frieder for some plagiarized code snippets 'Purpose: List all fonts in use in a document Dim strFonts As String Set objView = ActiveWindow.View bHidden = objView.ShowHiddenText 'show hidden text if currently hidden objView.ShowHiddenText = True For Each aStory In ActiveDocument.StoryRanges For Each aFont In FontNames With aStory.Find .ClearFormatting .Font.Name = aFont .Wrap = wdFindContinue .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False If .Execute = True Then 'This fills a string with the font list that 'is then displayed in the message box, but 'you could do whatever you need to with the 'font names here If InStr(strFonts, aFont) = 0 Then strFonts = strFonts & vbCrLf & aFont End If End If End With Next aFont Next aStory 'restore show hidden setting: objView.ShowHiddenText = bHidden MsgBox "Fonts in Document:" & vbCrLf & strFonts End Sub
-
WSJamesB
AskWoody LoungerHere is my crack at it. Kind of a different approach, not sure which is better, or if mine is flawed; I welcome any comments.
Sub ListFontsUsedinDoc() Dim strFonts As String Set objView = ActiveWindow.View bHidden = objView.ShowHiddenText 'show hidden text if currently hidden objView.ShowHiddenText = True For Each aStory In ActiveDocument.StoryRanges For Each afont In FontNames With aStory.Find .ClearFormatting .Font.Name = afont .Wrap = wdFindContinue .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False If .Execute = True Then 'This fills a string with the font list that 'is then displayed in the message box, but 'you could do whatever you need to with the 'font names here strFonts = strFonts & vbCrLf & afont End If End With Next afont Next aStory 'restore show hidden setting: objView.ShowHiddenText = bHidden MsgBox "Fonts in Document:" & vbCrLf & strFonts End Sub
Gary,
I just pretty blatantly plagiarized your hidden text code, hope you do not mind.
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Updates seem to have broken Microsoft Edge
by
rebop2020
29 minutes ago -
Wait command?
by
CWBillow
1 hour, 19 minutes ago -
Malwarebytes 5 Free version manual platform updates
by
Bob99
3 hours, 24 minutes ago -
inetpub : Microsoft’s patch for CVE-2025–21204 introduces vulnerability
by
Alex5723
10 hours ago -
Windows 10 finally gets fix
by
Susan Bradley
18 hours, 53 minutes ago -
AMD Ryzen™ Chipset Driver Release Notes 7.04.09.545
by
Alex5723
20 hours, 13 minutes ago -
Win 7 MS Essentials suddenly not showing number of items scanned.
by
Oldtimer
14 hours, 46 minutes ago -
France : A law requiring messaging apps to implement a backdoor ..
by
Alex5723
1 day, 9 hours ago -
Dev runs Windows 11 ARM on an iPad Air M2
by
Alex5723
1 day, 10 hours ago -
MS-DEFCON 3: Cleanup time
by
Susan Bradley
5 hours, 6 minutes ago -
KB5056686 (.NET v8.0.15) Delivered Twice in April 2025
by
lmacri
1 hour, 47 minutes ago -
How to enable Extended Security Maintenance on Ubuntu 20.04 LTS before it dies
by
Alex5723
1 day, 21 hours ago -
Windows 11 Insider Preview build 26200.5562 released to DEV
by
joep517
2 days, 1 hour ago -
Windows 11 Insider Preview build 26120.3872 (24H2) released to BETA
by
joep517
2 days, 1 hour ago -
Unable to eject external hard drives
by
Robertos42
11 hours, 50 minutes ago -
Saying goodbye to not-so-great technology
by
Susan Bradley
1 hour, 36 minutes ago -
Tech I don’t miss, and some I do
by
Will Fastie
5 hours, 24 minutes ago -
Synology limits hard drives
by
Susan Bradley
3 days, 5 hours ago -
Links from Microsoft 365 and from WhatsApp not working
by
rog7
2 days, 7 hours ago -
WhatsApp Security Advisories CVE-2025-30401
by
Alex5723
3 days, 11 hours ago -
Upgrade Sequence
by
doneager
3 days, 5 hours ago -
Chrome extensions with 6 million installs have hidden tracking code
by
Nibbled To Death By Ducks
1 day, 10 hours ago -
Uninstall “New Outlook” before installing 2024 Home & Business?
by
Tex265
2 days, 3 hours ago -
The incredible shrinking desktop icons
by
Thumper
4 days, 8 hours ago -
Windows 11 Insider Preview Build 22635.5240 (23H2) released to BETA
by
joep517
4 days, 10 hours ago -
Connecting hard drive on USB 3.2 freezes File Explorer & Disk Management
by
WSJMGatehouse
1 day, 9 hours ago -
Shellbag Analyser & Cleaner Update
by
Microfix
1 day, 2 hours ago -
CISA warns of increased breach risks following Oracle Cloud leak
by
Nibbled To Death By Ducks
4 days, 19 hours ago -
Outlook 2024 two sent from email addresses
by
Kathy Stevens
5 hours, 13 minutes ago -
Speeding up 11’s search
by
Susan Bradley
2 days, 7 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.