XL97 - Making a Userform Modeless:
The following routines are hacks that I found while experimenting with Application Commandbars in a UserFrom. Not sure why it works but calling the function makes a form modeless !?!
Note: Whilst it makes the form Modal you cannot interact with the Spreadsheet ie no inputs, just selecting.
Method1:
Downside:
You will have to put up with the About Microsoft Excel screen - thats it !!
So for Xl97 users try this: (Also works with Xl2000, even when ShowModal = True !!
In the Userform Code;
Private Sub UserForm_Click()
Application.CommandBars.FindControl(ID:=927).Execute
End Sub
Check it out and see what you get !
It doesn't have to be in the Click event, assign it to a button.
Method 2: By Colo
This method was supplied by my good friend Colo. Thankyou Colo
Option Explicit
'---Standard module
Sub Test()
UserForm1.Show
End Sub
Option Explicit
'---Userform1 module
Private Sub CommandButton1_Click()
' If Error message is shown, delete or comment out of following.
CommandButton1.TakeFocusOnClick = False
ActiveCell.Activate
ActiveCell.Value = "What?"
End Sub
'---Userform1 module
Private Sub UserForm_Activate()
With Application
.SendKeys "{esc}", True
.GetOpenFilename
.SendKeys "{esc}", True
End With
End Sub
UNC :
UNC is an acronym for Universal Naming Convention
UNC provides a naming convention for identifying and using network resources such as a network server, without connecting to it with a Mapped Drive - A mapped drive uses a drive letter for example, drive Y, where the letter represents the server and share to which it is mapped. UNC identifiers typically consist of three parts;
1 Server name \\<Server>
2 Share name \<Share>
3 and an optional file Path \MyDir\MySubDir
These are combined using backslashes or slashes. UNC notation is used primarily for mapping network drives in the Windows family of Operating Systems and are most commonly used to reach file servers or printers on a LAN.
Typical UNC path syntax: \\Stor01\Shared\moalai
Use UNC conventions when you are moving workbooks between diferent machines that may have been mapped to a different drive letter.
Below is some code to get the UNC paths given it's drive letter.
Mapping a Drive:
If you ever needed to map a Network drive to a Drive letter and provide a password, then here is one way to accomplish this. I use this to connect to our network drives without providing the user with my password. Obviously you need authorising rights before you can connect up.
See code below::