Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2017, 04:53 AM
jajukhan jajukhan is offline Newbie - Help - VBA script Windows 8 Newbie - Help - VBA script Office 2010 32bit
Novice
Newbie - Help - VBA script
 
Join Date: Sep 2017
Posts: 1
jajukhan is on a distinguished road
Question Newbie - Help - VBA script

Hi,
I am a newbie and was hoping for some help. I have an existing word 2010 document, what I would like to do is get people to either accept or reject (i.e. Click Yes or No) to my Terms & Conditions before opening that Word document.

I have used the below code as a test and it works great. But now instead of a pop up box. I need something slightly bigger where I can show the entire Terms & Conditions statement.

What I have in mind is, a pop-up form/box that shows the entire T&C statement but with a scroll bar so that users are not overwhelmed with a load of text. Then, simply click Yes or No.

Thanks in advance.
Aj


The code is used and adapted is below:
Private Sub Document_Open()

Dim wdApp As Word.Application
Set wdApp = GetObject(, "Word.Application")

Dim TermsConditions As String

TermsConditions = MsgBox("Greetings", vbYesNo, "Greetings")

If (TermsConditions = vbYes) Then
Exit Sub



ElseIf (TermsConditions = vbNo) Then
wdApp.ActiveDocument.Close


End If


End Sub
Reply With Quote
  #2  
Old 11-04-2017, 10:23 AM
FionaMcKenzie FionaMcKenzie is offline Newbie - Help - VBA script Windows 10 Newbie - Help - VBA script Office 2016
Novice
 
Join Date: Oct 2017
Location: Surrey, United Kingdom
Posts: 14
FionaMcKenzie is on a distinguished road
Default

Hi there,

Sounds like you need to create a user form with a multiline textbox control to contain the Ts & Cs.

Go to your VBE environment (Alt+F11) and right click in the Project Explorer to insert a new UserForm. Use the Toolbox to add shapes for interacting with on your form (controls). If you don't learn enough by reading on how to work with UserForms let me know and I will send you a code stub. If you design the userform, please just let me know the names you give to your controls (objects built on the form) and I will send you code.

Good luck! This is how your knowledge will grow and it's fun.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script Template __John__ Word 0 06-24-2016 02:41 PM
Newbie - Help - VBA script Outlook VBA Script kcm5153 Outlook 1 04-07-2015 11:41 PM
Bolding in script ksigcajun Word VBA 10 02-23-2015 08:29 AM
Help with VBA script nsyrax Word VBA 1 01-18-2014 03:38 AM
[ask] about VB Script + Ms. Project anak_baru Project 2 03-10-2009 01:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft