Yammer the SPAMmer!

I recently was invited to join some new group on a website called Yammer (yammer.com) by people I have never heard of before. Now all of a sudden I am bombarded by notifications, hundreds of notification in the past day alone!

Sadly their own unsubscription link doesn’t work and returns an error stating that I don’t have access to view the page (as illustrated by the image below)?????

Yammer's Unsubscribe Link Error

So I did a simple WHOIS on the domain. For anyone else interested, below is the e-mail addresses for reporting this SPMA abuse:

You can report it to Yammer’s themselves at: hostmaster@yammer-inc.com
And you could also report them to their registry service at: abuse@godaddy.com

In all cases the contact’s name, if this means anything to you, is Matthew Knopp.

You can also report them to any number of SPAM services to get their IP/Domain blocked.

If this is a genuine new discussion forum, it has been horribly setup by some truly amateur programmers! From my perspective, since I never subscribed in any way, they are plain and simple SPAMmers! Someone should introduce them to Opt-In techniques to say the least!

VBScript – Backup a File and add a Date Time Stamp

In an Access forum a user was asking how they could make an automated backup of their database.

Their are a number of possible solutions, including:

  • If your IT department already performs routine backups, simply ask them to add your database to their backups
  • You could install a backup program yourself

Another viable solution is to create a simple Batch file (*.bat) of VBScript file to perform the backup and then use the Windows Task Scheduler to run it on the basis of your choice (typically nightly).  To help you get this process setup and running, below are 2 VBScripts to perform the backup of the database file.

Continue reading

Open a PowerPoint Presentation using VBA Late Binding

I was recently trying to help someone on a forum with a very simple question: “How can I open a PowerPoint presentation using VBA, a macro”?

Simple.  Copy the following function into a standard module

'---------------------------------------------------------------------------------------
' Procedure : OpenPPT
' Author    : Daniel Pineault, CARDA Consultants Inc.
' Website   : http://www.cardaconsultants.com
' Purpose   : Open a PowerPoint presentation
' Copyright : The following may be altered and reused as you wish so long as the
'             copyright notice is left unchanged (including Author, Website and
'             Copyright).  It may not be sold/resold or reposted on other sites (links
'             back to this site are allowed).
'
' Input Variables:
' ~~~~~~~~~~~~~~~~
' sFile             : Fully qualified path and file name of the PowerPoint presentation
'                     to open.
' bRunAsSlideShow   : True/False whether to start the presentation in (True) slideshow
'                     mode or (False or omitted) not (standard mode).
'
' Usage:
' ~~~~~~
' Call OpenPPT("C:\Users\Daniel\Documents\MyTest.ppt")
' Call OpenPPT("C:\Users\Daniel\Documents\MyTest.ppt", True)
'
' Revision History:
' Rev       Date(yyyy/mm/dd)        Description
' **************************************************************************************
' 1         2013-Nov-08             Initial Release
' 2         2014-Mar-26             Added Slideshow parameter
'---------------------------------------------------------------------------------------
Function OpenPPT(sFile As String, Optional bRunAsSlideShow As Boolean)
    Dim oPPT            As Object
 
    On Error Resume Next
    Set oPPT = GetObject(, "PowerPoint.Application")    'See if PowerPoint is already running
    If Err.Number <> 0 Then    'Nope, so open a new instance to work with
        Err.Clear
        Set oPPT = CreateObject("PowerPoint.Application")
    End If
    On Error GoTo Error_Handler
    oPPT.Visible = True
    oPPT.Presentations.Open (sFile)
    If bRunAsSlideShow Then oPPT.ActivePresentation.SlideShowSettings.Run
 
Error_Handler_Exit:
    On Error Resume Next
    Set oPPT = Nothing
    Exit Function
 
Error_Handler:
    MsgBox "The following error has occurred." & vbCrLf & vbCrLf & _
           "Error Number: " & Err.Number & vbCrLf & _
           "Error Source: OpenPPT" & vbCrLf & _
           "Error Description: " & Err.Description, _
           vbCritical, "An Error has Occurred!"
    Resume Error_Handler_Exit
End Function

As indicated in the procedure header, then you need only call the function whenever you wish to open a presentation using 1 single line:

Call OpenPPT("C:\Users\Daniel\Documents\MyTest.ppt")

Obviously, replace “C:\Users\Daniel\Documents\MyTest.ppt” with your path and filename and do not forget the file extension.

Hope this helps.

MS Access – Image Control On Click Event in Continuous Form Not Returning the Proper Record/Primary Key

I recently was creating a continuous form (using Access 2007) and wanted to use an Image control as a delete button, of sorts.  I rapidly encountered a small problem (what I personally perceive to be a glitch/bug within Access).  Access would not always delete the record on which I was clicking the Delete Image control.  So in fact, it was deleting the wrong records!  So I started performing a few tests and discovered that the Image Control was not returning the proper primary key (PK) value for the record on which the Image Control was clicked?!  The only way it deleted the proper record was to first set the focus on one of the other controls for the record I wish to delete and then click on the delete image.  So you need to manually change the focus.  This obviously was not a potential production solution for real-world usage.

I asked my fellow MVPs to see if (i) if it the behavior was reproducible, (ii) if this was a known issue and receive the following informative and confirming explanation from Dirk Goldgar:

I can confirm that, at least for Access 2010, clicking on an image control doesn’t move the focus to the control, and thus doesn’t change the current record.  It seems that, like a label, the image control can’t receive the focus, so clicking on it has no effect on what control and record are active and current.

This would explain the issue.

 

The Workaround/Solution

The only solution I came up with (and later was offered the same solution by other MVPs) was to overlay a transparent button (Format -> Transparent = Yes) over top of the Image Control and use it’s On Click event instead.  So use the image for the visual you are after, but use the button for the actual action.

Determine Installed Version of any MS Office Program – VBScript

In my previous post I show 2 vbscripts to determine the versions of MS Access, as well as, Internet Explorer. But what do you do if you need to determine the version of Excel, Word, Outlook, etc? Well it can be done as well. Below is a basic, but versatile vbscript that can return the version of almost any program installed on a PC. Please note, it needs more coding to allow for exceptions, but the basic are there.

Method 1 – File System Object (FSO)

Dim oRegistry
Dim oFSO
Dim sKey
Dim sAppExe
Dim sValue
Dim sAppVersion
Const HKEY_LOCAL_MACHINE 	= &H80000002

Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//./root/default:StdRegProv")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sKey = "Software\Microsoft\Windows\CurrentVersion\App Paths"
'sAppExe = "excel.exe"
'sAppExe = "GROOVE.exe"
'sAppExe = "infopath.exe"
sAppExe = "MSACCESS.EXE"
'sAppExe = "MSPUB.EXE"
'sAppExe = "OneNote.exe"
'sAppExe = "OUTLOOK.EXE"
'sAppExe = "winword.exe"
'sAppExe = "firefox.exe" 'Even works with a number of other programs!
oRegistry.GetStringValue HKEY_LOCAL_MACHINE, sKey & "\" & sAppExe, "", sValue
MsgBox oFSO.GetFileVersion(sValue)
Set oFSO = Nothing
Set oRegistry = Nothing

Method 2 – WMI

Dim oRegistry
Dim oWMIService
Dim colFiles
Dim oFile
Dim sKey
Dim sAppExe
Dim sValue
Dim sAppVersion
Const HKEY_LOCAL_MACHINE 	= &H80000002

Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//./root/default:StdRegProv")
Set oWMIService = GetObject("winmgmts:\\.\root\cimv2")
sKey = "Software\Microsoft\Windows\CurrentVersion\App Paths"
'sAppExe = "excel.exe"
'sAppExe = "GROOVE.exe"
'sAppExe = "infopath.exe"
sAppExe = "MSACCESS.EXE"
'sAppExe = "MSPUB.EXE"
'sAppExe = "OneNote.exe"
'sAppExe = "OUTLOOK.EXE"
'sAppExe = "winword.exe"
'sAppExe = "firefox.exe" 'Even works with a number of other programs!
oRegistry.GetStringValue HKEY_LOCAL_MACHINE, sKey & "\" & sAppExe, "", sValue
Set colFiles = oWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where Name = '" & replace(sValue, "\", "\\") & "'")
For Each oFile in colFiles
    MsgBox oFile.Version
Next

Set colFiles = Nothing
Set oWMIService = Nothing
Set oRegistry = Nothing

In both cases, the procedures return a value such as: 15.0.4749.1000 which you can easily parse out the first set of numbers to identify the major version of the software (if that is what you are after).

Now, according to http://blogs.technet.com/b/heyscriptingguy/archive/2005/04/18/how-can-i-determine-the-version-number-of-a-file.aspx?Redirected=true Method 2 is best. Although both limitations of Method 1 have no impact on my usage. Furthermore, Method 1 was faster in my tests.

Also, if you are running 64-bit, then you may need to also check the

sKey = "Software\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths"

Determine Installed Version of Internet Explorer – VBScript

Below is a simple VBScript to determine the version of Internet Explorer installed on your PC.

Dim oRegistry
Dim oRegistry
Dim sKey
Dim sValue
Dim sAppVersion
Const HKEY_LOCAL_MACHINE 	= &H80000002

Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//./root/default:StdRegProv")
sKey = "SOFTWARE\Microsoft\Internet Explorer\"
oRegistry.GetStringValue HKEY_LOCAL_MACHINE, sKey, "Version", sValue
sAppVersion = Left(sValue, InStr(sValue, ".") - 1)
MsgBox sAppVersion & ""
Set oRegistry = Nothing

Simply save the above in a text file and name it as you please with the extension vbs, close and save. Then double click on it and it should return a message box with the version number of Internet Explorer.

Determine Installed Version of MS Access – VBScript

Below is a simple VBScript to determine the current version of MS Access installed on the computer

Dim oRegistry
Dim sKey
Dim sValue
Dim sAppVersion
Const HKEY_CLASSES_ROOT 	= &H80000000

Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//./root/default:StdRegProv")
sKey = "Access.Application\CurVer"
oRegistry.GetStringValue HKEY_CLASSES_ROOT, sKey, "", sValue
sAppVersion = Right(sValue, Len(sValue) - InStrRev(sValue, "."))
MsgBox sAppVersion & ""
Set oRegistry = Nothing

Simply save the above in a text file and name it as you please with the extension vbs, close and save. Then double click on it and it should return a message box with the version number of your Access currently configured MS Access installation.

WebBrowser ActiveX Control – Google Maps Invalid Character Scripting Error

I had an MS Access database which had been in place for over a year and that was working just fine.  One day, at the beginning of October 2013, my client informed me that they had recently started receiving a Scripting error (see the image below) every time the form displayed a map (Google Maps) of an address, any address.

WebBrowser_GoogleMaps_Script_ErrorAt first, I assumed it was a Google glitch and figured we’d give the Google team a chance to rectify whatever the issue was.  That said, days, weeks, went by and the problem remained.  So it was time to do some more digging.

During the testing phase. I was able to confirm that using the same URL directly in a web browser (IE, FireFox, Chrome) all displayed just fine without any errors.  Furthermore, the error itself did not occur on every machine.  This leads me to seriously believe it has to do with some windows update that is applied to certain computers and not others.  If it were truly a Google issue, it would be generalized, which it evidentially is not!

I also, after some reading, was lead to believe it was due to Internet Explorer’s ‘Compatibility Mode’, but after performing a few simple tests, this was quickly ruled out as the source of the problem.

At this point I was at a loss as to what to do, so since I am an MS Access MVP, I sent an e-mail out to my fellow Access MVPs to see what others might suggest.  Alex Dybenko, provided me with the key piece of information to figure out the root cause of the problem.  Using a nifty piece of software that he had, he was able to identify that the WebBrowser control (with my MS Access database) was returning that it was running as a User-Agent MSIE 7.0 on his system, even though his actual IE browser was MSIE10.0?!  After performing the same test, I identified that my WebBrowser controls was reporting to be MSIE6.0 rather than MSIE10.0.

Hence, the WebBrowser control is actually running in a dumbed down mode, when compared to the actual version of Internet Explorer that you installed.  So apparently, Google Maps does not play nice with older versions of Internet Explorer.

Knowing what the actual issue what, I when digging online to see what could be done.  I eventually came across an obscure registry key that can be used to tell a program to use a specific IE emulation version.

The solution is a simple Reg Hack to for the WebBrowser control to switch it’s emulation to a more recent version of MSIE (MicroSoft Internet Explorer).

Open RegEdit and navigate to the following Registry Key (and yes you need to perform this registry hack on every computer running your database!) depending on the application using the WebBrowser control (not your OS!).

32-bit
HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

32bit-FEATURE_BROWSER_EMULATION

64-bit
HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

64bit-FEATURE_BROWSER_EMULATION

Then create a new DWord entry in which you specify the program executable that has the WebBrowser control in it  as the ‘value name’ and use one of the following values for the Decimal ‘value data’

7000: IE7 Emulation
8000: IE8 Emulation
8888: Force IE8 Emulation
9000: IE9 Emulation
9999: Force IE9 Emulation
10000: IE10 Emulation
10001: Force IE10 Emulation
11000: IE11 Emulation
11001: Force IE11 Emulation

So since we are talking about an issue with the WebBrowser within our MS Access database, we create a DWord with msaccess.exe for the Value Name and I used 9999 as the value data. Error message gone.

As usual, you could easily create a bat, vbscript, VBA routine to push this into the registry as part of your program or installation routine!  I was recently asked if I could supply an example of such code.  As such, feel free to download  one of my samples:

WebBrowserEmulationRegistryHack_MSAccess
WebBrowserEmulationRegistryHack_MSExcel

That said, be forewarned that improper editing of the Registry can permanently damage your computer to the point of it not working anymore.  I assume no responsibility whatsoever for the sample/code provided.  It is provided for educational purposes only, and it is your responsibility to validate and test it to ensure it works properly.  It was put together rapidly in the hopes it might help, but has not been fully tested.

Also note, since it impacts the executable, in our case msaccess.exe, this hack will impact all databases containing WebBrowser controls. This could theoretically cause problems with older databases, so you could easily push the registry hack at the startup of your db and delete it upon closing, to try and minimize impacting other databases. Obviously, if they are opened at the same time, there is little you can do.

This hack works for MS Access databases, MS Excel, WPF, Visual Studio projects, anything that uses the WebBrowser ActiveX control.

Hopefully this will help someone else!

References

If you are looking for further information, fellow MVP Tom van Stiphout recently brought the following article to my attention: Web Browser Control – Specifying the IE Version
MSDN – Internet Feature Controls (see the section entitled Browser Emulation)

 

Extra

If you aren’t looking to fix the issue, but rather simply make the error not display, you can always place the following in the Form’s load event

Me.WebBrowserControlName.Object.Silent = True

How to remove viruses, malware, spyware from a computer?

More and more, I am being asked to clean up people’s computers which/who’s:

  • become horribly slow
  • display pop-up
  • won’t boot
  • web browsers take them to pages they didn’t ask to go to
  • etc…

Now a days, it is becoming impossible to perform a cleanup of an infected computer with a single solitary tool.  But which tools are trustworthy?!  That is the real issue.  Sadly, one has to be VERY careful about which tools you use to scan and remove such elements from your computer.  The sad truth of the matter is that many free software available online actually infect your computer with the exact type of threat that you are trying to eliminate.  These companies exploit people who are already in a mess of a situation.  To what end you may ask, it is always the same goal, to collect personal information (credit card number, account information, etc…) or make you buy their PRO version of their software ($$$).  It’s always about information and money!

Regardless.  Below are a few tools (in no particular order) that I have used and trust.

I typically would start using RKill, SpywareBlaster and install the MVPs Host file, before running the other programs for a couple of reasons, but mainly because they are very quick to run. I’d also verify the Windows StartUp items (Task Manager → Startup apps) and running processes from the Task Manager, review the list of installed programs, clear browser cache, check the installed browser extensions, delete temp folder content, …  Then I move on running applications such as: MalwareBytes, RogueKiller, … knowing that these processes will possibly take hours!

Once I get a system back up and running, I remove shortcuts, links, etc. to Microsoft Internet Explorer and install the latest version of Mozilla Firefox, Brave or LibreWolf (there are a whole slew of alternate browser see: http://en.wikipedia.org/wiki/Comparison_of_web_browsers but carefully review all the elements, especially the security and vulnerabilities).  Internet Explorer is known to have more security issues and vulnerabilities and as such I try to avoid it as much as possible.  I also avoid browsers such as Google Chrome because of their privacy statements.  Remember, if you do install a new browser, be sure to re-immunize your system with Spyware Blaster.

Lastly, remember to scan your PC on a regular basis (ideally on a weekly basis, or as a bare minimum at least once a month).
 

Important Notes:

  • Always ensure you are using the latest version of each application.
  • Always perform an update of the tools (definitions) before running them!
  • Remember.  Always rerun each tool until no more threats are identified!  This may mean running certain tools a number of times.

Also, don’t be afraid of a format/fresh install of Windows. Sometime this is the most time efficient and best way to ensure a proper cleanup.

Lastly, SERIOUSLY consider setting up the PC user as a plain Windows User account, rather than the default administrator account. This can greatly hinder the damage that can be caused by such software and/or hackers.
 

For the specific case in which a WinXP computer is in a continuous login loop (brings up the loading windows and then restarts, over and over and over again), please look at Dan’s website and follow the detailed instruction very carefully!  Once you manage to get back into your system thanks to his SaveMe utility, then proceed to run the aforementioned programs to clean it.

Run Microsoft Security Essentials at Login

I wanted to setup a computer so that it would automatically run a ‘Quick Scan’ every day when the user logs into it.

I started out trying to create a Scheduled Task.  Sadly, for whatever the reason (decided to stop fighting with it after having wasted 2hrs trying to get it to work) I kept getting permission errors.  Furthermore, it becomes very difficult to perform a definition update and then a scan, and delay things a little to not impact login…  So Scheduled Tasks were not the answer.

I fiddled with Batch files, and they do work, but I decided, to turn to vbScript because I was more familiar and it allowed, in my opinion, more power and easier coding.

Here is what I came up with:

'*******************************************************************************
'Author:	Daniel Pineault / CARDA Consultants Inc.
'Copyright:	All rights reserved, 2013
'Purpose:	Update MSE and then perform a Quick Scan of the system
'			Place in the AllUser startup folder so it run everytime someone
'			logs into the computer.
'Revision:	2013-10-04   Initial Release
'*******************************************************************************
Dim sMSEInstlRegKey 
Dim sMSEPath 
Dim sMSECmdLineExe 
Dim sMSEUpdate 
Dim sMSEQuickScan 
Dim oShell
Dim lDelay

'Locate the MSE installation folder so we can use the cmd line
sMSEInstlRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Antimalware\InstallLocation"
sMSEPath = ReadFromRegistry(sMSEInstlRegKey,"")
sMSECmdLineExe = "MpCmdRun.exe"
'Build our 2 commands
'Build the Update Definition command
sMSEUpdate = chr(34) & sMSEPath & sMSECmdLineExe & chr(34) & " -SignatureUpdate"
'Build the Quick Scan command
sMSEQuickScan = chr(34) & sMSEPath & sMSECmdLineExe & chr(34) & " -Scan -1"  '1-Quick Scan  2-Full Scan
'Define the delay, so the scan run slightly after actual logon, so as to not slow down the
'login process - try to make it a little less painful to the end-user.
lDelay=1000 * 60 * 1

'Actual run the commands
Set oShell = CreateObject("WScript.Shell")
WScript.Sleep lDelay 'Delay the script per the delay defined above
oShell.Run sMSEUpdate, 0, True	'Update the virus definition(s)
oShell.Run sMSEQuickScan, 0, True	'Scan the Computer
Set oShell = Nothing

Function ReadFromRegistry (strRegistryKey, strDefault)
    Dim WSHShell, value

    On Error Resume Next
    Set WSHShell = CreateObject("WScript.Shell")
    value = WSHShell.RegRead( strRegistryKey )

    if err.number <> 0 then
        readFromRegistry= strDefault
    else
        readFromRegistry=value
    end if

    set WSHShell = Nothing
End Function

All you have to do is save the above code into a simple text file and name it as you wish, but give it a vbs file extension.  In my case, I simply named it ‘MSE.vbs’.  Then, to make it run for every user when they login, simply place the file in the AllUser StartUp folder.

You could easily modify this script to say run a Quick Scan Tuesday through Friday, but on Monday’s run a Full Scan…  The possibilities are endless!

Also remember that Microsoft Security Essentials also has a basic scheduler built-in, so don’t go looking to complicate things for no reason should you only require a straight forward scheduling.