I want to set the message signature automatically each time Outlook starts. Unfortunately, the classic approach using Application_Startup() doesn't work for this. It seems that the objWord.EmailOptions.EmailSignature object is not yet available at this stage of application startup.
Is there a way to execute the script, after Outlook finishes startup?
Private Sub Application_Startup()
Set objWord = CreateObject("Word.Application")
Set objSignatureObjects = objWord.EmailOptions.EmailSignature
objSignatureObjects.NewMessageSignature = "Internal"
objSignatureObjects.ReplyMessageSignature = "Internal"
End Sub
The signatures are being kept as separate files in the Signatures folder. You can find this folder in the following locations:
Windows XP
C:\Documents and Settings\%username%\Application Data\Microsoft\Signatures
Windows Vista, Windows 7, Windows 8 and Windows 10
C:\Users\%username%\AppData\Roaming\Microsoft\Signatures
To see this folder you must have View hidden files and folders enabled or you can simply copy and paste the above paths in the address bar in Explorer to directly open the folder.
At any point in time, you may go there and edit them - deleting, adding, changing and etc.
Related
I have written a VBScript that helps me organise my desktop every time it gets messy.
It works fine it moves my files and shortcuts based on the extension and the name of the app. However, I have a few app shortcut links that just won't move. in fact the vbs script will not even see them with this basic script
Set FSO = CreateObject("Scripting.FileSystemObject")
dir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
Set folder = FSO.GetFolder(dir)
Set files = folder.Files
For Each file in files
MsgBox file.Name
Next
The files in question are all shortcuts they are iTunes, VLC, Google Chrome and WinRar.
Is there anything I can check to see why vbs won't even see these files?
What You can see on your desktop is hybrid view of two folders:
C:\Users\YourUsername\Desktop
C:\Users\Public\Desktop
Where the Public one is usually a place, where shortcuts are being created during app install, so all users do have them. In your script You are only looking for files in the YourUserName\Desktop, that's why the script does not see those shortcuts.
I need to access folder on a SharePoint using VBA however the SharePoint requires Windows credentials and I do not want to map to a network drive.
When I run the code initially I get a 'path not found' error. If I open the SharePoint location in Windows Explorer it asks for my login, then when I go back to VBA the code works. I don't want to have to paste the file location into Windows Explorer every time I run it.
The code looks something like this:
Set FSO = CreateObject("scripting.FileSystemObject")
Set myFolder = FSO.GetFolder("\\this.location\foo\bar")
Is there any way to make VBA realise the path does actually exist and to prompt for the user's credentials?
Thanks.
I am trying to install fonts in windows XP using a VBScript. But for some reason my script works fine in Windows 7 but does not work in Windows XP. I need to install fonts without a system reboot so, I had to choose this approach instead of other registry change approaches which would need a system reboot. Here is my VBScript
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("D:\Logs\")
Set objFolderItem = objFolder.ParseName("Roboto-Italic.ttf")
objFolderItem.InvokeVerb("Install")
My guess is the InvokeVerb("Install") command is not working in Windows XP. In that case are there any alternatives? Please guide me Thanks...
Next script (a code snippet) should work on (obsolete) Windows XP:
Const ssfFONTS = &H14&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(ssfFONTS)
objFolder.CopyHere "D:\Logs\Roboto-Italic.ttf"
If the font is already installed then you could be prompted to overwrite it. Not sure whether or not reboot required using above approach...
See ShellSpecialFolderConstants enumeration
Specifies unique, system-independent values that identify special
folders. These folders are frequently used by applications but which
may not have the same name or location on any given system.
Among others:
ssfFONTS 0x14 (20). Virtual folder that contains installed fonts. A
typical path is C:\Windows\Fonts.
Read Hey, Scripting Guy! How Can I Install Fonts Using a Script?:
As soon as the font has been added to the folder, the operating system
will immediately install the font for you...
That’s true, but with one very important caveat: you must copy the
file using the Shell object. Admittedly, you can use WMI or the
FileSystemObject to copy a file into the Fonts folder; however,
when you do so the operating system will not automatically install the
font for you. As far as we know, the only programmatic way to get
Windows to recognize that a new font has been added to the Fonts
folder, and thus get Windows to install that font for you, is to use
the Shell object.
Is there some way I can programmatically (in VBS) OR by using CMD/RUN open the 'Open' dialog that contains the places bar and a browser but without opening say notepad or MSpaint?
http://i.technet.microsoft.com/dynimg/IC354177.jpg
I'd like to use this on the desktop itself, it would be really cool if there was a DLL I can just use instead of having a VBS file but if not i'm sure its possible in VBS.
I'm busy searching where the actual open dialog box comes from, it should come from some DLL file somewhere.
I might even consider stopping the windows shell from opening all together and just using this open window as the shell on some computers.
Regards, Rocklore
What version of Windows are you on?
"UserAccounts.CommonDialog" was the way to do this in XP. But it no longer exists in Windows 7. You may be able to use some of the flags available for the BrowseForFolder() method to make it look like a file open dialog. See this page for an example.
XP Edit:
Here's an XP example using UserAccounts.CommonDialog.
With CreateObject("UserAccounts.CommonDialog")
.InitialDir = CreateObject("WScript.Shell").SpecialFolders("Desktop")
.Filter = "All Files|*.*"
' Show the dialog. If [Open] is clicked, save the name of the selected file...
If .ShowOpen Then strFile = .FileName
End With
Where is in the registry the path executed when I run the "notepad" command in windows "Start->run command" interface? I want to change it for notepad++ (it is required so, although could look not really good)
If you are like me you use windows run command all the time. I hate using the mouse to point and click a shortcut on the start menu. WIN-R are probably the two most over used keys on my keyboard. After thinking about if awhile I hunted down how the run command works. It turns out that it makes a call to ShellExecute, which I guess is not too surprising. The next thing I wanted to find out was exactly how the commands are resolved. The following is an ordered list of how they are resolved ([1]):
The current working directory
The Windows directory (no subdirectories are searched)
The Windows\System32 directory
Directories listed in the PATH environment variable
The App Paths registry key
Naturally the next thing I wanted to do was customize existing commands or add new commands so I do not have to type as much (standard lazy approach). After examining my options which were to put the executable in one of those paths (since it only locates executables and not shortcuts), modify the path environment variable or add a key to App Paths. The App Paths option seems to be the easiest and most flexible to me. Here is a layout of what you need to do to add an App Paths entry ([1]):
HKEY_LOCAL_MACHINE-->
SOFTWARE-->
Microsoft-->
Windows-->
CurrentVersion==>
App Paths-->
file.exe-->
(Default) = The fully-qualified path and file name
Path = A semicolon-separated list of directories
DropTarget = {CLSID}
Disclaimer: Modifying the registry can cause serious problems that may require you to reinstall your operating system. I cannot guarantee that problems resulting from modifications to the registry can be solved. Use the information provided at your own risk.
The minimum needed to add a new entry is to add the key file.exe where file is the string you want to type into the run command and to add the Default entry which is the fully-qualified path to the file you want to execute. Note that even it the file you are going to reference isn't an exe file you still need to put the .exe on the key. Here is a sample registry file that I created to add a shorter keyword for Internet Explorer:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\ie.exe] #="C:\Program Files\Internet Explorer\iexplore.exe"
After entering that entry into the registry I can simply type “ie” at
the run command to open internet explorer.
Here is a list of some common commands I use at the run command:
cmd – Command prompt winword – Microsoft Word excel – Microsoft Excel
outlook – Microsoft Outlook iexplore – Internet Explorer firefox –
Mozilla Firefox notepad – Notepad compmgmt.msc – Computer Management
Console control appwiz.cpl – Add/Remove programs dialog mstsc –
Microsoft Terminal Service Client regedit – Registry Editor
…
If there is some program that I find myself using all the time I figure out what the run command is for it and if there is not a short easy one I add one to my App Paths as described above. Does anyone else have some other common run commands they use?