VbScript for Command Button on Contacts Custom Form

Status
Not open for further replies.

mdmomtaz

Member
Outlook version
Outlook 2016 64 bit
Email Account
IMAP
Hi Diane,
I've created Custom Form for new Contacts entry. Because I need some custom Fields. I need two command buttons. One for upload file path/name in a text box and the other to view the file in its default application. My problem is that only on set of VBScript is working, the one on the top of the Script editor. I need both Click Events to work. I'm spending hours but no way. Please help me get out of this problem.
VBScript below:

Sub CommandButton2_Click()
Set wShell=CreateObject("WScript.Shell")
Set oExec=wShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
sFileSelected = oExec.StdOut.ReadLine
Set FormPage = Item.GetInspector.ModifiedFormPages("General")
Set Control = FormPage.Controls("TextBox1")
Control.Value= sFileSelected
End Sub

Sub CommandButton3_Click()
msgbox "This is command button 3"
End Sub


Thanks in advance for your help.
Momtaz

Form image.png
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
A VBscript stops running after updating form Outlook VBA and Custom Forms 1
B VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
M Forward Appointment as BCC with VBScript Outlook VBA and Custom Forms 7
D Security patch seems to kill vbscript on Enterprise Level Outlook VBA and Custom Forms 4
R VBScript Commands Outlook VBA and Custom Forms 2
Mark White VBScript Move sent mail to non-default folder Outlook VBA and Custom Forms 5
Mark White VBScript Move sent mail to non-default folder Outlook VBA and Custom Forms 0
S my vbscript button1_click code works on appointment created but not on opening an existing apntmn Outlook VBA and Custom Forms 16
JorgeDario Template oft that contains VBScript Is not running Using Outlook 1
J Outlook 2010 VBScript editor does not run code at all Outlook VBA and Custom Forms 0
T Create new item in public folder using VBscript Outlook VBA and Custom Forms 1
R VBScript Sendmail not selecting correct 'from' address Outlook VBA and Custom Forms 3
B Recommended Outlook & VBScript Books? Outlook VBA and Custom Forms 3
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
K VBScript Outlook, add attachment Outlook VBA and Custom Forms 1
S VBA Macro to VBScript Outlook VBA and Custom Forms 1
E VBScript to replace module? Using Outlook 3
F VBScript to add pre defined text Using Outlook 5
D Custom form and VBScript Using Outlook 5
F VBScript copy contacts and remove duplicates Using Outlook 1
R VBA Macro to VBScript in a form- Help Please! Using Outlook 10
H Accessing a control on a frame in Outlook with VBScript Outlook VBA and Custom Forms 1
Y Creating a Task with VBScript Outlook VBA and Custom Forms 14
N VBScript does not run in Outlook 2003 Outlook VBA and Custom Forms 4
M Move command Outlook VBA and Custom Forms 11
bdsermons Outlook 365 command button in outlook form Outlook VBA and Custom Forms 5
S Command Button_Click action on Item/Reminder Outlook VBA and Custom Forms 3
J Command Button to stamp a date and time in a textbox in Outlook 2016 Outlook VBA and Custom Forms 3
J OUTLOOK 2016 FILE STORAGE WHERE COMMAND Using Outlook 12
D Command Button code will not execute. Any suggestions Please. Outlook VBA and Custom Forms 2
D Custom Form Accept and Reject Command buttons Outlook VBA and Custom Forms 2
S Problem running Command button code Outlook VBA and Custom Forms 2
Dr. Demento Outlook version of Excel command? Using Outlook 5
L Outlook Data Files command not working in the quick access bar Using Outlook 1
R Missing Backup command in File menu after installing pfback.exe Using Outlook 2
S Code behind form command button Using Outlook 2
S Exchange Management Shell closes on command failure Exchange Server Administration 5
M Open new outlook form from within existing outlook form using command button Using Outlook 4
M "New Appointment from Contact" command missing from Outlook 2003 Using Outlook 1
J Executing Ribbon Command from Code Outlook 2010 Outlook VBA and Custom Forms 3
A Command Button Controls Outlook VBA and Custom Forms 6
S How to call a procedure from a custom command bar in Outlook 2007 Outlook VBA and Custom Forms 1
L Outlook 2003 - Set Virables via command line Outlook VBA and Custom Forms 1
T Command bar IDs for Outlook 2007 Using Outlook 2
J Command Button to insert Email Signature Outlook VBA and Custom Forms 2
T Is there a VBA command to Redirect your Emails? Outlook VBA and Custom Forms 1
Z Command button no longer firing after sending custom form over ema Outlook VBA and Custom Forms 1
A How to access command bars in outlook 2007 Outlook VBA and Custom Forms 3
U Customized Command Button Outlook VBA and Custom Forms 3
5 How to get Outlook's command line parameters? Outlook VBA and Custom Forms 1

Similar threads

Back
Top