VBScript to exe - vbscript

I have written a code to create a new menu in MS Word and do some functions. I have written VBScript code in the scripting window which opens when i do Alt+F11.
I cannot send the code to the customer and have to bundle it in an exe file or some other file and send it to user.
How do i do that.
If i create an exe file when the user runs it the menu button should be cretaed in MS Word on users machine.
Thanks
Creator

The simplest options are:
Add the VBA to the normal template and you can make it run when Word loads to add your menu items.
Create an add-in from the macro project (These can be read only/password protected)
Create a managed/VSTO add-in

Related

VB script to open .exe file and perform 4 activities

I have a tool based on .net. I need a vb script which would open this tool (.exe file) and then select 3 radio buttons, click on a button to browse a xml file stored in same folder and then click on invoke button. Is this possible? I am a complete fresher and just have this idea in mind for an automation. This is required as I have to perform the same steps daily.
I could find this code:
CreateObject("WScript.Shell").Run("""C:\Users\abc\Desktop\folder\Tool.exe""")
Which is doing my task to open the .exe file perfectly. Can someone help/guide me in achieving the further steps?
You might be better off making your tool work via the command line and having it accept arguments.
That way, you could use a .bat file to call your 'tool' passing in the arguments it needs and away you go.
These should get you started on your quest.
Creating a HelloWorld Console Application Using VisualBasic.NET
How to Parse Command Line Parameters?
What is a bat file

Excel Workbook Open event from within an addin?

I am trying to trigger a macro to run when an Excel document is opened.
The problem I am running into is that all of my code resides within an Excel add-in. The Workbook_Open event doesn't work because I can't put the code in individual documents, I need it to reside in the add-in and run whenever any document is opened.
Is there a way to modify the Workbook_Open event or is there another way to trigger a macro when a different document is opened?
You need to use an Application event. There is a good writeup on how to do this at Chip Pearson's site here.

How to start to write a Windows context menu

I would like to write a context menu for Markdown files for Windows XP, when I right click on a Markdown file it should display "View in browser" option. It could use MardownSharp or Discount to convert it in HTML and show it using the default browser. I guess that building such feature shouldn't require too much knowledge of the Windows platform. My question is: where should I start considering the fact that I would want to write this tool without using MS Visual Studio (I would like to use opensource software)? Could it be possible to use Mono?
See this answer on how to convert Markdown to HTML. As far as adding this as a context menu, this is a built-in feature of the Windows registry:
Browse to or create the following key. This assumes the file extension is .mdml (as I am unfamiliar with any set standard on this file format). If that's not the case, replace .mdml with the file extension(s) you are looking for, or * for all files, regardless of extension.
HKEY_CLASSES_ROOT\.mdml\Shell\
Browse to or create a new sub-key called something like "View in browser" and a sub-sub-key called "Command" (must be this word). In that key, modify the default to display the program and arguments to launch (e.g. C:\WINDOWS\SYSTEM32\NOTEPAD.EXE "%1").
You should now be able to browse to
HKEY_CLASSES_ROOT\.mdml\Shell\View in browser\Command\
and see the launch parameters in (Default).

Catching the "Open with..." in Visual Basic 2010 Express?

I'm creating a small program for viewing images. However, the whole idea is that it could be used as a default for image-files. So, how can I catch the file, that user tries to open? Path to file is enough. Here's an example:
User right-clicks an image and chooses "My Program" from the "Open with..."-menu. Now I need to see, what file the user wants to see.
I'm an absolute beginner in VB, so please be patient with me =D
Martti Laine
If you create a file association (MSFT KB Article 307859 for details how to do this manually), then your application will be started with the file set as one of the arguments.
You can use Environment.GetCommandLineArgs() to get those arguments.

WinAPI: Call context menu entry provided by shell extension

The software Dropbox provides an shell extension which adds context menu items to all files in a specific folder. One of these generates a public link to view the selected file.
In a C# tool I want to call this entry without any user interaction. I want to achieve the same behavior as if the user clicked on the context menu item of a selected file.
I know that the shell extension is provided by a DLL, is it possible to make a call to this DLL to achieve the expected behavior?
Shell extensions implement IContextMenu and it is possible to execute menu commands without showing a menu (See this blog post for details about "hosting" IContextMenu)
Once you have the menu, you would call IContextMenu::GetCommandString and look for a specific verb, if Dropbox does not have a somewhat unique verb, you are going to have to do something hacky, either match by menu text alone, or call the Dropbox shell extension dll directly (DllGetClassObject export) and fake everything (Pretend to be COM and shell) or if you know the CLSID, you can at least get help from COM and just do the shell part.
There is a freeware tool called runmenu that allows you to play with shell menus/IContextMenu (I'm sure you can find a copy somewhere)

Resources