Home » Programming » MS Office
Category Archives: MS Office
Using a Batch File to Start an Access Application Hosted on a Local Area Network
If you are creating MS Access applications, then you will probably want to set up custom workgroups and give your users the ability to log into your application as a workgroup user that has various levels of access. You will also want to host the Access application centrally on your LAN to avoid problems with multiple instances of the database existing.
The easiest way set up your application is by creating a custom .MDW (workgroup security) file and hosting this together with your main .MDB database file on your local area network for your users to access. Then in order for your users to be able to launch the application and log in from their desktop machines, you can create a simple batch file for them to click on.
For example, if you had your Access files on a network path such as:
\\MyNetwork\AccessApps\
Let’s assume your users are running MS Access 2002 on a Windows XP machine. This means that on their local machines, the default path to the MS Access executable would be:
C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE
This path above will of course vary based on the version of MS Access and the version of Windows that your users are running.
Configuring a Web Server to Allow Excel File Creation via the Interop.Excel Namespace
In an earlier article I covered how to generate Excel reports on the fly using the Interop.Excel Namespace.
This is a really handy technique that also gives you full control over the minutia of the document you are creating. However the catch in using this technique is that you will need to update the configuration of your Web server to allow Web users to trigger Excel on your Web server. This can mean some pretty drastic security changes and possible loopholes in your Web server’s security so you should do a risk analysis before choosing this method.
In this article I will review the Web server security updates that need to be made to allow using the Interop.Excel Namespace to generate Excel documents for your Web site.
Please note that since I am developing this site for an Intranet, I am not as concerned with locking down the server. If you are working with a server that is exposed to the Web then you will want to review these security changes much more thoroughly.
(more…)
ASP.NET – Generating an Excel Report on the Fly Using the Interop.Excel Namespace
Choosing the best way to export your data from an ASP.NET Web page to Excel for your users is never an easy task. There are many ways to accomplish this task, each way having its pros and cons.
In an earlier article I covered one of the more common ways: how to take an existing report that has already been generated as an HTML table and stream it as Excel to the client browser. This is a great technique, but leaves it up to Excel to interpret the HTML that you are sending its way. Furthermore, Microsoft seems to be deprecating the markup that was previously so amazingly convenient when formatting HTML streamed to Excel. The article also goes into depth about what markup commands are still useful and what markup has been deprecated. It’s definitely worth reading this article if you are considering streaming HTML as an Excel document using the command: Response.ContentType = “application/ms-excel”
Before I go into further details on using the Interop.Excel namespace to generate Excel files, I’d like to point out that I am providing a fully functional example at the end of this article. If you are primarily interested in the code, then you can skip to the bottom of this article and you can copy and paste the code sample into a Visual Studio project where it should run without any problems.
(more…)
Microsoft’s New Outlook.com and Why You Should Care
So with all of the hype surrounding Microsoft’s new Outlook.com webmail system, one has to ask oneself exactly what the benefits are to this new system. Is Outlook.com just another online email service just like the rest? Or is there something unique that distinguishes it from similar systems by Google or Yahoo?
Keep in mind that these are just my personal opinions and I’m sure many would strongly disagree. However, from what I can see there are a few key features which really make Outlook.com stand out from the crowd: (more…)
How to get an Outlook.com Email Address
Yesterday (August 1 2012) I wrote a post about how to upgrade your old Hotmail account to Microsoft’s new Outlook.com this article also covered how to get your new MyEmail@outlook.com webmail address. However, I put the steps for upgrading your email address last in the article which isn’t very visible to people interested in upgrading. So in the interest of clearly explaining to people how to get your Outlook.com email address, here are the steps again:
How to get an Outlook.com Email Address
Microsoft has made it very straightforward for existing Hotmail users to upgrade their accounts to Outlook.com. Likewise they have also made getting your new outlook.com email address as painless as possible.
Hotmail Rebranding to Outlook.com & You Can Get a New Outlook.com Email Address!
Microsoft announced recently (July 30 2012) that it is deprecating its Hotmail.com email service in favor of a new version called Outlook.com. This is part of Microsoft’s continued push to make its products more Web-based and integrated.
The best part is that you can now get an example123@Outlook.com email address to replace your old Hotmail address.
So What’s in Store?
Microsoft will continue to explore integrating social media with its products including Outlook.com email accounts. It’s my guess that this may involve more integration of Outlook.com with Microsoft’s experimental So.cl social media platform.
I’m a fan of the new Outlook.com service since Outlook has been Microsoft’s professional email software platform for many years now. So integrating the Web-based email service with the Outlook name just makes a lot of sense. As another plus, Microsoft intends to keep its new Outlook.com service free.
(more…)
VSTO for MS Outlook 2007 – Using msocontroledit and msoControlComboBox in the Commandbars
VSTO for MS Outlook can be a powerful way to customize Outlook programmatically. However, the syntax can be finicky at times and I have found a few instances where the programming logic becomes tricky.
For example, you can use VSTO to add a text box to the Outlook command bar window. This can be put to a number of good uses when building a custom component for Outlook. My thoughts behind adding the controls to Outlook were to allow the user to select a type of search to run in the custom dropdown list, and then to use the text box for the user to add text that the system would use to run a search on custom email fields.
In my case I wanted to add a textbox and a ComboBox to my main Outlook Explorer view. The VSTO controls in Outlook are called msoControlEdit and msoControlComboBox respectively.
At first glance adding a simple text box and dropdown list sounds like a simple requirement. But as I found out, this isn’t quite the case. The problem? Outlook by default will clear any entered text from the new text box when focus is lost. I’m not sure what the reasoning behind this is, but from reading help articles and forum posts, it appears that many people are coming up against the same problem.
As a positive, the ComboBox control does retain selected text, so we will not need to worry about handling this control.
For the convenience of readers of this article; I am including a full example of how to add a textbox and a ComboBox to the Outlook main command bar at the end of this article.
(more…)
Outlook Email Searches Broken by Indexing
Against any sort of logic, running email searches in Outlook on one of my development machines no longer returns any results for even the simplest searches.
I am running Windows 7 and Office 2007 on my development machine. On another, older development machine I am running Windows XP with Office 2007.
Now the strange thing is the inconsistency in how both versions of Office run. I’m not sure if it is the OS or some other factor, but the completely mystifying problem of Outlook on my Windows 7 machine not searching emails correctly appeared that I could not duplicate on my XP machine.
(more…)
VS2010 Custom Outlook Folder View Including UDFs (User Defined Fields)
If you are building an Outlook Add-In application with Visual Studio, it’s likely that at some point you will want programmatic control over the information that Outlook shows in a specific email folder.
For instance, let’s say that you have code that automatically backs up sent emails to a custom folder hierarchy. So if the email you sent includes sample code, then the email should be automatically backed up into a custom sub-folder called “Sample Code” that exists within your custom “Programming” folder within your Outlook mailbox. If that sounded confusing, here’s an image of what I’m talking about:
+Mailbox |_Programming |_Notes |_Sample_Code |_General |_Sent Items |_Etc...
(more…)
VS2010 Outlook ThisAddIn – How to Get the Sent Email Message
When writing an email add-in for Outlook with Visual Studio, it’s really quite easy to get the email message object while the send event is in progress using the Application.ItemSend event. However this event happens before the email is sent, so although it can be useful, the Application.ItemSend event is often not the correct event handler to be used when working with Outlook email messages programmatically.
SQL OpenRowSet Excel Query Returns Null Values
In an earlier article I reviewed how to query an Excel spreadsheet from SQL Server Management Studio (SSMS). I’ve found that this functionality is very useful, especially when working with data maintained by business users outside of a database system.
For an overview of how to connect SSMS with an Excel WorkSheet, please see my detailed article covering the subject. I continue to use the method of saving my SpreadSheet as a .xls format file which I then connect to using the OpenRowSet command with the Microsoft Jet OLEDB 4.0 driver. Once the Excel worksheet is query-able by SSMS it’s quite simple to work with this data just like you would work with a regular table.
However, one important caveat is that if your worksheet contains numeric as well as alphabetic data, this will confuse the driver and depending on the order of the data in your Spreadsheet, null results will be returned instead of the numeric data.
This behavior can be surprising when one first notices it, but happily it can be easily corrected so that you can properly query mixed data type columns.
(more…)
VSTO .NET4 Outlook 2007 Add-in: Referencing Form Regions Programmatically
In this article I intend to further expand on my series of articles covering VSTO development of MS Outlook Add-in components using Visual Studio 2010. In previous articles I have covered things such as adding custom actions to archive email messages via the Application_ItemSend event, as well as adding custom code to save Outlook email messages to a database in the .MSG format.
I will review how to integrate a custom form with events in the Outlook Add-in component. However, I won’t review the GUI aspects of custom form development in Visual Studio since this primarily involves stepping through Wizards and drag and dropping controls to the form UI in Visual Studio. I will assume this is fairly self explanatory and has been covered in depth by Microsoft on it’s support Web site.
(more…)
.NET Save Outlook Email to Database as Byte Array
In a previous article I wrote about how to create a custom add-on for Outlook that will archive emails based on a keyword in the Email’s subject line. I will expand on this concept to show how to convert the sent email from an Interop.Outlook.MailItem COM object to a save-able .MSG email message. The ultimate goal of this is to convert the sent email into a format that can be saved to a database table as a VarBinary datatype.
Background Info: Why Convert the Email to .MSG Format?
Using the Application_ItemSend method of a Visual Studio 2010 Outlook Add-in project, one can capture the Email message being sent using the Outlook.MailItem object. Although in theory it would make sense that one could directly convert this object to a Byte array to be saved in a database table, this is in fact not a viable option. The Outlook.MailItem object is in fact a COM object that cannot be dynamically saved/loaded. To achieve the desired save/load functionality the Outlook.MailItem object will first need to be converted to a .MSG file.
(more…)
Outlook 2007 Image Distortion in Email
Problems with Images in Emails
I have noticed strange image distortions happening when I embed an image in an Outlook email message. I’m not talking about adding the image as an attachment, but about directly embedding the image in an HTML-formatted email message so that it immediately shows for the recipient.
The strange thing is that this will happen rather randomly. About 70% of the time embedded image shows up perfectly at the receiving end. However it’s the remaining 30% that’s been a concern because the image will either arrive with:
- Significant quality loss
- Sizing distortions
- Only partially rendering
(more…)
Outlook Custom Add-In to Archive Emails on Send Based on Keyword in Subject Line (Visual Studio 2010)
Background
The great thing about the Microsoft technology stack is that things tend to work together without the need to download and install unfamiliar libraries from unknown sources. I continue to be impressed by how Microsoft centralizes its code libraries with Visual Studio and .NET 4 to make most development tasks quite seamless.
For example I am working on an add-on component for MS Outlook 2007 that will help people archive their sent emails by including a keyword in the subject line of their email.
Visual Studio has default project templates for Office, including templates for Outlook 2007 and Outlook 2010. Happily enough, the code required to interface with Outlook is auto-generated behind the scenes and the programmer simply has to worry about writing the actual logic of the component. This is a big step forward from how things used to be!
Another big plus for my development efforts is the set-up and deployment project template that Microsoft has included with Visual Studio. Once my Outlook component has been fully coded I can simply create a Deployment project to send out to users. That way a user can install my component simply by clicking the ‘Next’ button on an installer wizard.







