-
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. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
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
-
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
3 hours, 45 minutes ago -
Flash Drive Eject Error for Still In Use
by
J9438
5 hours, 17 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
22 hours, 37 minutes ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
22 hours, 38 minutes ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
2 hours, 17 minutes ago -
Migrate off MS365 to Apple Products
by
dmt_3904
3 hours, 5 minutes ago -
Login screen icon
by
CWBillow
5 hours, 43 minutes ago -
AI coming to everything
by
Susan Bradley
1 hour, 4 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
1 day, 14 hours ago -
No Screen TurnOff???
by
CWBillow
1 day, 14 hours ago -
Identify a dynamic range to then be used in another formula
by
BigDaddy07
1 day, 15 hours ago -
InfoStealer Malware Data Breach Exposed 184 Million Logins and Passwords
by
Alex5723
2 days, 2 hours ago -
How well does your browser block trackers?
by
n0ads
1 day, 13 hours ago -
You can’t handle me
by
Susan Bradley
13 hours, 4 minutes ago -
Chrome Can Now Change Your Weak Passwords for You
by
Alex5723
1 day, 5 hours ago -
Microsoft: Over 394,000 Windows PCs infected by Lumma malware, affects Chrome..
by
Alex5723
2 days, 14 hours ago -
Signal vs Microsoft’s Recall ; By Default, Signal Doesn’t Recall
by
Alex5723
1 day, 17 hours ago -
Internet Archive : This is where all of The Internet is stored
by
Alex5723
2 days, 14 hours ago -
iPhone 7 Plus and the iPhone 8 on Vantage list
by
Alex5723
2 days, 14 hours ago -
Lumma malware takedown
by
EyesOnWindows
2 days, 2 hours ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
2 days, 23 hours ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
2 days, 23 hours ago -
Meet Gemini in Chrome
by
Alex5723
3 days, 3 hours ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
3 days, 3 hours ago -
Trump signs Take It Down Act
by
Alex5723
3 days, 11 hours ago -
Do you have a maintenance window?
by
Susan Bradley
1 day, 16 hours ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
2 days, 13 hours ago -
Cox Communications and Charter Communications to merge
by
not so anon
3 days, 14 hours ago -
Help with WD usb driver on Windows 11
by
Tex265
1 hour, 56 minutes ago -
hibernate activation
by
e_belmont
3 days, 23 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.