VbScript for Command Button on Contacts Custom Form

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
 
Thread starter Similar threads Forum Replies Date
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
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
P "open" command in right click context menu Outlook Wishlist 4
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
B command "recall message" in Outlook 2011 for Mac Using Outlook 1
C Suppress output when using get command Exchange Server Administration 4
C Exchange 2007 Shell command to find users who are members of Recipient Administrator Exchange Server Administration 3
S vb.net exchange 2010 problem with enable-mailbox command Exchange Server Administration 2
L Trying to receive email without the send/receive command Using Outlook 6
P Will 'ldap modify' command work on some Active Directory fields? Using Outlook 2
J What is the command to view the ManagedFolderAssistantSchedule? Exchange Server Administration 3
J How to Find Registry Key Command for Outlook 2010 Issue? Using Outlook 1
G How to determine the "Distinguished Name string" of a security group for New-ManagementScope command Exchange Server Administration 2
C 503 Valid RCPT command must precede DATA Using Outlook 2
V Upload a CSV file, created from a BCP command into Outlook calendar Using Outlook 1
O Outlook 2010: Rule to move sent emails doesn't start if I Use "Send To" command on a file on desktop Using Outlook 3
J Error Code 503: Valid RCPT command must precede DATA Using Outlook 1
O Exchange 2010 "Get-mailboxdatabse" command fails Exchange Server Administration 2
Similar threads


















































Top