Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 9th, 2013, 02:41 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Click a button on a form programmatically

Dear wise ones

I have two macro enabled templates, producing documents in landscape and portrait orientation respectively. Each template has two forms. The first is a disclaimer form and is loaded by the autonew function on the templates, the second form (which is the main data entry form) loads when the OK button is clicked on the disclaimer. The disclaimer also contains a cancel button which unloads the form.

The templates produce documents (medication lists for patients) and usually only a landscape OR a template version will be required (the landscape version hold a little more information about the medications, the portrait version is more of a simple list). Occasionally however, people in the organisation will want to produce BOTH a landscape and a portrait version. To prevent them having to repeat the process of data entry twice, I have placed an option button on the main data entry form that will enable this. So far so good.

My problem is that if a person working in (say) the portrait template also wants a landscape document and checks the option button to do this, the section of the subsequent code that will open the second document:

Documents.add Templates:= ...........

Will cause the autonew macro to fire on the template and for the disclaimer form to open on the second document. I want to stop this happening.

In a nutshell therefore, what I want to do is to programmatically click the cancel button on the disclaimer form when it opens so that the user never sees the disclaimer form at all.

Working in Word 2010.

My first post, and looking forward to your assistance. Thanks everyone!
Reply With Quote
  #2 (permalink)  
Old December 6th, 2013, 08:00 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Have you tried using SendKeys

http://vbadud.blogspot.in/?m=1

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Data Will Not Display When I Click On Display Button sprdave BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 12 February 12th, 2011 11:09 PM
on the click of a button how to load another form? amit_mande@yahoo.com VB.NET 2 September 12th, 2006 06:53 AM
Button Click ~Bean~ ASP.NET 1.0 and 1.1 Basics 2 September 27th, 2005 09:32 AM
creating reports thru a button click on a form clueless_may Access VBA 3 May 13th, 2004 09:34 PM



All times are GMT -4. The time now is 05:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.