Archive for VBA Advanced
Archives
- ActiveX Programming
- Add an Image to Cell Comments
- Add Sheet Navigation CommandBar to an Excel file or Application
- Auto-Generate a File Name
- Automate File Download from Internet
- Automate WebLogin…
- Convert Decimal to RGB Color Value
- Copy Ranges from Different Sheets into one Sheet
- Create HyperlinkObject on Sheet
- Create LogFile for Workbook Open
- Create Sheet “Table of Contents”
- Create ShortCut Link at the desired location
- Create UserForm at Runtime using Code
- Display Userform with no Title Bar (Splash Screen)
- Downloads
- Downloads from www.jkp-ads.com
- Export a Text File with Comma and Quote Delimiters
- Get elements from HTML form
- Get FileName with Path from User
- Get FileNames with Path from User
- Hyperlink Elements in HTML
- Ken’s Knowledge Base submissions
- Login to Rediffmail
- Move a File
- Multiple Cell Concatenation
- Other Site Links
- Read CSV Using VBA techniques
- Remove Unprintable Character & Spaces from cells
- Rename a File
- Rename Files using Codes (VBA)
- Resources
- Resources
- Search Folders and Subfolders for files
- Show Status on Userform While executing Code
- Site Contents
- socko.wordpress.com — Technorati Search
- Sort WorkSheets by Name
- Sorting Text with Worksheet Formula
- test
- Use of vbScript in Database Applications
- Userform Resizer – VBA
- Userforms
- VBA Code Library
- vbaX KB Links
- Verify that a File Exists
- Web Forms manipulated by Visual Basic
- Write to & Read from Sequential Text Files
Create UserForm at Runtime using Code
– Selva V Pasupathy, HSBC Global Resourcing, Hyderabad
The following code, I found at http://www.eng-tips.com, is the process to create a UserForm dynamically using a macro in VBA.
- From the VBE (open Excel and hit ALT+F11)you need to set a reference to the extensibility add-in. To do this, go to Tools/References and find the add-in Micrsoft
Visual Basic for Applications Extensibility - Create a macro module in the project file. To do this, right-click on VBAProject and
select Insert->Module. - Right-click the module and select View Code.
- Paste this code into the window:
|
Display Userform with no Title Bar (Splash Screen)
– Selva V Pasupathy, HSBC Global Resourcing, Hyderabad
Normally when a userform is initiated you would see it with a blue title bar by default everytime. But if you want to use the userform as a title form, then one would be interested in removing the titlebar. One more userful Tip I came across at Colo’s Excel Junk Room – Masaru Kaji. The following code shows userform with no titlebar and closes after few seconds. |
HOW SHOULD I USE THE FOLLOWING CODE
Copy the following code in standard code module.
|
Copy following code into the userform code.
|
To download Example file CLICK HERE
Saving userform in Excel as an image
-Selva V Pasupathy, HSBC Global Resourcing, Hyderabad 1
Original source: Colo’s Excel Junk Room – Masaru Kaji
Last week I was working on an excel application where I wanted several images of the userform at various stages so that I can prepare SOP for documentation. It was difficult for me because on my system Print Screen button was not working and I did not know how to activate that. While browsing hte net and going through colo;s junk room, I came across the code below which saves a userform as an image when you double click on the userform. With API, this code pastes an image of the form into a worksheet of the new workbook, then save it as a HTML file. When the Excel workbook is saved as a html file, all image files will be placed in the different folder.
HOW SHOULD I USE THE FOLLOWING CODE Place the following code in a userform module. |
|
To download example file CLICK HERE
Code to Create FileHandle on Users’ Desktop
by Selva V Pasupathy, HSBC Global Resourcing, Hyderabad |
While at my workplace, I came across a situation when to get input from users, we had to create a file but without giving physical access to the users to that file. The code below helps to create a vbs file on desktop and you may ask the users to click on the vbs file to open the workbook and they can start the input through userform. I set application visible property as false, so user will be able to see only userform, and it will make you get a feel of a standalone application. I am not sure whether this will be a successful attempt, but there is nothing wrong in giving this a try. |
|