Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!
'Button to create a new Account Request form Sub cbuttonAttach_Click() ' Insert hyperlink to the new form and change the subject on the task Dim AcctName Set AcctName = Item.UserProperties("Requestor/Caller") item.body="<\\hcterm\pub\" & AcctName & ".xls>" item.subject="Process Account Request Form" item.save Dim xlApp As New Excel.Application Dim xlWB As New Excel.Workbook Dim oSheet As Excel.Worksheet Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True Dim sSourceFile' As String Dim sDestDir' As String sSourceFile = "\\HCTERM\PUB\ACCOUNTREQUESTFORMS\COMPUTERACCOUNTREQUESTFORM.XLT" sDestDir = "\\HCTERM\PUB\ACCOUNTREQUESTFORMS" 'Check source file exists If Dir$(sSourceFile) = "" Then MsgBox "Source File Not Found" Else 'Make dest dir If required If Dir(sDestDir, vbDirectory) = "" Then MkDir sDestDir End If 'Copy the template file to new empty form with the user's name FileCopy sSourceFile, sDestDir & "\" & AcctName & ".xls" End If End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.