Thursday, December 30, 2010

Random Function

Returns an evenly distributed random real number greater than or equal to 0 and less than 1. A new random real number is returned every time the worksheet is calculated.

Syntax

=RAND( )

Remarks

To generate a random real number between x and y, use:
RAND()*(x-y)+x

If you want to use RAND to generate a random number but don't want the numbers to change every time the cell is calculated, you can enter =RAND() in the formula bar, and then press F9 to change the formula to a random number.




Thursday, December 23, 2010

Create Excel Report

Sub ExcelReport()



' Prepare MS Excel for work
Set xlApp = CreateObject("Excel.Application")


' View Excel object 
      xlApp.Visible = True


' Add new Workbook to excel sheet.
xlApp.Workbooks.add
Set xlsheet = xlApp.Workbooks(1).Worksheets(1)


' Select the Sheet1 and rename it what ever your want...
xlsheet.Activate
xlsheet.Name = "[Sheet Name]"

' Add values/formulas to excel Cells...


xlSheet.Range("A1").Value = "No"
xlSheet.Range("B1").Value = "Name"
xlSheet.Range("B1").Value = "Value"


xlSheet.Range("A2").Value = "1"
xlSheet.Range("A3").Value = "2"
xlSheet.Range("A4").Value = "3"


xlSheet.Range("B2").Value = "ABC"
xlSheet.Range("B3").Value = "PQR"
xlSheet.Range("B4").Value = "XYZ"



xlSheet.Range("C2").Value = "100"
xlSheet.Range("C3").Value = "200"
xlSheet.Range("C4").Value = "300"

xlSheet.Range("B5").Value = "Total Value"
xlSheet.Range("C5").Value = "=Sum(C2:C4)"


End Sub

Removing unused field names from your Notes application design.



Hello Developers,


If you have been doing Notes development for any length of time, you have run into this situation.  Coping an existing application as a starting point for a new app, change the form design, go to create a new view, and your list of field names to select from has both sets of field names from both apps.  And a worst case scenario appear, you end up with a damaged design because you have too many unique field names or the length of all the field names is larger than supported by Notes.  You do a search on discussion forums and find instructions on how to remove unused field names, but for some reason they don't quite work.  That's certainly been my lot in life with this process...
I found the following Knowledgebase item the other day, I tried this and much to my surprise, I was able to remove unused field names!  I think the key for me was the compact step.  In the article, they give you a command line way to run the ncompact task.  I think I was just assuming I could do that through the client (either Notes or Administrator) and it never worked.  When I used the command line version of the compact, it worked like a that....


So...  To save you the same pain, here's the entry...


Deleted Fields Still Showing in List of Fields When Writing Formula


Problem: 
In Notes R4 and later, fields that you have deleted from your database are still listed when you are writing a formula and click on the Fields & Functions button.


Content: 
Whenever a new field is added to a database, it is added to the Unique Field List.  The Unique Field List is used in the Fields & Formulas dialog box in R4 and the Reference tab's "Database Fields" list.  A new field can be added to a database by adding it to a design element, a document, or depositing a document into a database that contains new field names.  If the field is deleted or renamed in a document and/or design element, it will remain in the Unique Field List until the database is Compacted.  When the Compact process runs, it will scan all documents and design elements to recompile the Unique Field List.  If the field does not appear anywhere in the database, it will not appear in the Unique Field List after Compact has finished. 


If the database is flagged as full text indexed, the fields will NOT be removed from the list of fields by Compact.  Delete the full text index by using the Database Properties InfoBox (File, Database, Properties, click the Full Text tab, and click the Delete Index button), and then Compact the database. 


So, the proper steps to delete unwanted fields from the field list would be: 


1.        Delete the field(s) from all documents in the database. 
2.        Delete the field(s) from the design of all forms and subforms in the database. 
3.        Delete the database's full text index. 
4.        Compact the database.  




In one known customer case, after trying the solution presented above, it was discovered that a corrupt subform was the culprit.  Copying and pasting the subform did not resolve the issue; however the following actions allowed the unwanted field(s) to be removed: 


1.        Select all the design elements on the subform. 
2.        Copy the elements to a new subform. 
3.        Delete the original subform. 
4.        Compact the database.   


Note:  One method of ensuring that the unwanted field(s) are no longer in the database is to perform a design synopsis of the entire database (File, Database, Design Synopsis), and then search the synopsis for the field name(s).

Monday, December 20, 2010

Windows 7 some of the hidden features


Shake your desktop free of clutter
If you frequently run multiple programs simultaneously, your desktop can get extremely cluttered. This can get annoying, if you're working on one program and want to minimize all the other windows -- in previous versions of Windows you had to minimize them individually.

With Windows 7's "shake" feature, though, you can minimize every window except the one in which you're currently working -- in a single step. Click and hold the title bar of the window you want to keep on the desktop; while still holding the title bar, shake it quickly back and forth until all of the other windows minimize to the taskbar. Then let go. To make them return, shake the title bar again.

You can accomplish the same thing by pressing the Window key-Home key combination -- although doing that is not nearly as much fun.


Add a Videos link to the Start Menu
The Windows 7 Start Menu includes links to your Pictures and Music folders, but not to your Videos folder. If you watch a lot of videos and want a link to them on your Start Menu, here's what you can do:


Displaying the Videos folder on the Start Menu.
Click to view larger image.
1. Right-click the Start button and select Properties.

2. On the screen that appears, go to the Start Menu tab and click Customize.

3. In the dialog box that appears, scroll to the bottom, look for the Videos section, select "Display as a link," and click OK and then OK again.

If you'd prefer that Videos display as a menu, with links to files and submenus, instead select "Display as a menu."


Use check boxes to select multiple files
In order to select multiple files for an operation such as copying, moving or deleting in Windows Explorer, you generally use the keyboard and the mouse, Ctrl-clicking every file you want to select.

But if you're mouse-centric, there's a way to select multiple files in Windows 7 using only your mouse, via check boxes. To do it:

1. In Windows Explorer, click Organize, and then select "Folder and search options."

2. Click the View tab.

3. In Advanced Settings, scroll down and check the box next to "Use check boxes to select items." Click OK.

4. From now on, when you hover your mouse over a file in Windows Explorer, a check box will appear next to it; click it to select the file. Once a file is selected, the checked box remains next to it; if you uncheck it, the box will disappear when you move your mouse away.


Build your own Internet Search Connector
Windows 7 has a very useful new feature called a Search Connector that lets you search through a Web site from right inside Windows Explorer. With it, you type in a search term and select the Search Connector for the site you want to search; Explorer searches the Web site without having to open Internet Explorer, and the results appear inside Windows Explorer. Click any of the results to head there using your default Web browser.

Normally, you'll need to get each Search Connector from the Web site through which you want to search, and very few Connectors are available. Sites normally need to adhere to Open Search standards in order for their Connectors to work.

However, there's a work-around that will let you easily build your own Search Connector for any site, using Windows Live Search as a kind of go-between. Don't worry, you don't need to know any code to write a Connector. Just follow these steps:


1. Copy the following text and paste it into Notepad. The text you'll need to change is in bold, all-caps text:
NAME YOUR SEARCH
DESCRIPTION OF SEARCH
SITENAME.COM&web.count=50"/>
SITENAME.COM"/>
2. In place of NAME YOUR SEARCH, type in the name of the search as you want it to appear. In our case, we're going to build a Search Connector for Computer world, so we'll just type in Computerworld.
3. In place of DESCRIPTION OF SEARCH, type in a longer description of the search. In our instance, it will be Search through Computerworld.
4. In the two SITENAME.COM entries, enter the Web site's domain. Don't use the http:// or www -- just the domain name. In our instance it will becomputerworld.com.
5. To the right of "count=", type in the number or results you want to appear. In our instance, we'll keep it at 50.
6. In our example, here's what the code should look like (no bold necessary):
Computerworld
Search through Computerworld
computerworld.com&web.count=50"/>
computerworld.com"/>
7. Save the file in Notepad, choose UTF-8 from the Encoding drop-down box near the bottom of the Save As screen, and give it an .osdx extension. In our instance, we'll call the file Computerworld.osdx.
8. In Windows Explorer, right-click the .osdx file and select Create Search Connector. The Search Connector will be created.
9. You can now use the Search Connector. To get to it, in Windows Explorer go to YourName --> Searches --> Connector, where YourName is your account name, and Connector is the name of the Connector.

See taskbar thumbnails without a mouse
If you're a fan of using the keyboard rather than your mouse whenever possible, you can move your cursor from icon to icon in the taskbar without a mouse -- and still see thumbnail previews.
Press Windows key-T, and you'll move the focus to the leftmost icon on the taskbar. Then, while still pressing the Windows key, press T again to change the focus to the next icon to the right. You can keep doing this as long as you like.

Launch taskbar apps without a mouse
Likewise, you can launch any program on the taskbar without the mouse. Press the Windows key and the number that corresponds to the position of the application on the taskbar -- for example, Windows key-1 to launch the left-most application on the taskbar, Windows key-2 to launch the second left-most application and so on.

Run multiple copies of applications from the taskbar
The Windows 7 taskbar serves a dual purpose, which can get confusing at times. It's used to launch programs, and also to switch between programs that are running. So you launch a program by clicking its icon, and also switch to that program after it's running by clicking its icon.