Tuesday, April 13, 2010

DotNetNuke Stylesheet How to Format Code and Other Examples in a Block

This article was written for DotNetNuke, but the css styling applies to any web page.

If you have code or other instructions you want to show up in a block on your website, see this article.

In DotNetNuke Stylesheet How to Format Code and Other Examples in a Block

Monday, April 12, 2010

How to Include Multiple Forms on One Asp.Net Page

Asp.net only allows one form with the attribute server="runat" per web page.

See this article on How to Include Multiple Forms on One Asp.Net Page

Dynamically resize an iframe to size of contents without scrollbars

See this article to dynamically resize an iframe to it's contents, set the height of the iframe to the scroll height.

Sunday, March 14, 2010

How to Edit HTML Source in Outlook 2003 Message on XP

Also posted here

www.programmer.bz/Articles/tabid/159/asp_net_sql/157/How-to-Edit-Outlook-2003-Email-Message-HTML-Source.aspx

There was a brilliant post with a macro to edit the html source in Outlook 2003 on Windows XP. I made the tiniest of changes. Would
like to create the original poster, but the item was posted annonymously. Here is my version, using my naming conventions, but I
have to admit the original poster's was more readable. His (or hers) instructions were simpler too. Darn, someone smarter than me.

Instructions

1. In Outlook, go to Tools, Marco, Visual Basic Editor.

2. In the Visual Basic Editor

2.A Create a new Module (not a Class module) like Edit_Html.

2.B Copy in the code below.

2.C In the Visual Basic Editor go to Tools, References. Add references to Microsoft Scripting Runtime and Windows Scripting Host
Object Model.

2.D. Save

3. In Outlook, while editing an html message, press Alt + F8, select the macro Edit_Html.

Here is the code. Nice and simple

'----------------------------------------------------
Public Sub Edit_Html()
Dim filename As String
Dim filesystem As New Scripting.FileSystemObject
Dim item As mailitem
Dim shell As New WshShell
Dim filestream As TextStream
'----------------------------------------------------
' Put html body in a file
'----------------------------------------------------
Set item = ActiveInspector.CurrentItem
filename = filesystem.GetSpecialFolder(TemporaryFolder) & "\" & filesystem.GetTempName
Set filestream = filesystem.CreateTextFile(filename, True, True)
filestream.Write filename & item.HTMLBody
filestream.Close
'----------------------------------------------------
' Read file into wordpad
'----------------------------------------------------
Set filestream = Nothing
shell.Run "wordpad.exe """ & filename & """", , True
'----------------------------------------------------
' After exiting wordpad, read file into htmlbody
'----------------------------------------------------
Set filestream = filesystem.OpenTextFile(filename, ForReading, False, TristateTrue)
item.HTMLBody = filestream.ReadAll
filestream.Close
Set filestream = Nothing
End Sub
'----------------------------------------------------

www.DomainNames.gs for domain names

Wednesday, March 10, 2010

Asp.net Accessing Page Object from Controls During Initialization

When controls are initialized on an asp.net page, the Page object may not be available. You get an error message that says: Object
reference not set.

After initialization, during the Load phase, the Page object is available.

What if you need the Page object during the initialization phase, such as in the CreateChildControls method?

See here for the solution.

www.programmer.bz/Articles/tabid/159/asp_net_sql/156/Aspnet-Accessing-Page-Object-from-Controls-During-Initialization.aspx

Monday, October 5, 2009

Enable VB macros to run in Outlook

Want my macros to run on customers' computers with high security level. Find explanation of security levels here.
http://office.microsoft.com/en-us/ork2003/CH011480831033.aspx

Code signing certificates cost a few hundred dollars a year. Here is a list of providers from Microsoft.
http://msdn.microsoft.com/en-us/library/ms995347.aspx

To self sign, use selfcert.exe. Run
C:\Program Files\Microsoft Office\OFFICExx\selfcert.exe
http://www.howto-outlook.com/howto/selfcert.htm

In the VB Editor go to Tools, Digital Signature and add the certificate to the project.

Get out of the VB Editor and Outlook and go back in. Outlook will ask if you want to always trust macros from this certificate. Say
yes.

Outlook macro project is here.
File: VbaProject.OTM
Folder: %appdata%\Microsoft\Outlook
Example: C:\Documents and Settings\username\Application Data\Microsoft\Outlook

VbaProject.OTM location

The VbaProject.OTM is in the Application Data\Microsoft\Outlook folder for the user.

The %APPDATA% variable identifies this location.

See
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=341