![]() |
|
#1
|
|||
|
|||
![]() I would like to create a word page for survey purpose. After someone completes that survey and hit submit button result would come to me. How to do that? Any suggestions from any pro would be highly appreciated. ![]() |
#2
|
||||
|
||||
![]()
You would need to ensure that the user completing the form trusts you enough to allow macros to run. This is going to be an ongoing problem so I don't think Word is the best solution for you.
I would be using Acrobat or a Web-based form instead.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
||||
|
||||
![]()
Create a form using legacy form fields or content controls and add an activex button to the form with the following code. Save the form as a macro enabled document and send it to the users. As has been raised, there are issues relating to getting the users to run the macros. A web based form rather than a PDF form which creates further issues relating to data extraction, would be my choice of alternative:
Code:
Option Explicit Private Sub CommandButton1_Click() Dim bStarted As Boolean Dim olApp As Object Dim oItem As Object Dim oRng As Range Dim objdoc As Object Dim objSel As Selection Dim bProtected As Boolean If IsOutlook Then On Error Resume Next If Not ActiveDocument.ProtectionType = wdNoProtection Then bProtected = True ActiveDocument.Unprotect Password:="" End If Set oRng = ActiveDocument.Range oRng.Copy 'Get Outlook if it's running If bProtected = True Then ActiveDocument.Protect _ Type:=wdAllowOnlyFormFields, _ NoReset:=True, _ Password:="" End If Set olApp = GetObject(, "Outlook.Application") If Err <> 0 Then 'Outlook wasn't running, start it from code Set olApp = CreateObject("Outlook.Application") bStarted = True End If 'Create a new mailitem Set oItem = olApp.CreateItem(0) With oItem .BodyFormat = 2 .Display Set objdoc = .GetInspector.WordEditor Set objSel = objdoc.Windows(1).Selection objSel.Paste .to = "someone@somewhere.com" .Subject = "Survey Form" .Send End With If bStarted Then 'If we started Outlook from code, then close it olApp.Quit End If 'Clean up Set oItem = Nothing Set olApp = Nothing Else MsgBox "Please return this form to someone@somewhere.com" End If lbl_Exit: Exit Sub End Sub Private Function IsOutlook() As Boolean On Error Resume Next IsOutlook = (Not CreateObject("Outlook.Application") Is Nothing) lbl_Exit: Exit Function End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
esherwood | Mail Merge | 1 | 07-21-2014 09:55 PM |
![]() |
zelo | Word | 1 | 10-17-2013 11:15 PM |
Can I create Page Styles | janice_2k | Word | 1 | 08-24-2012 10:53 AM |
![]() |
Peterth | Mail Merge | 4 | 01-08-2012 09:13 PM |
![]() |
persist | Word | 1 | 04-07-2010 04:39 PM |