Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-22-2018, 12:50 PM
slaycock slaycock is offline SENDKEYS with vbYesNoCancel and Select Case Windows 7 64bit SENDKEYS with vbYesNoCancel and Select Case Office 2016
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

You need to use the 'Visual' bit of VBA and design yourself a user form which collects all of the information you need.

There are lots of tutorials on the web so I'm not going to redo that here.

Yours won;t be complicated as it looks like you only need two text fields to collect the information you need.



A couple of comments on your code.

1. The select case for Ans does nothing because you have no code following the case statements.

2. Consider switching from a document variable to a custom document property. The advantage of a custom document property is you can edit the value from the properties dialog box which is accessed via the Backstage page.
Reply With Quote
  #2  
Old 05-22-2018, 05:29 PM
kiwimtnbkr kiwimtnbkr is offline SENDKEYS with vbYesNoCancel and Select Case Windows 10 SENDKEYS with vbYesNoCancel and Select Case Office 2010 64bit
Advanced Beginner
SENDKEYS with vbYesNoCancel and Select Case
 
Join Date: Oct 2017
Posts: 69
kiwimtnbkr is on a distinguished road
Default

I can't claim any of the code as my own - it's what I have found by searching google for what I want to do and then trial and error to see if it works as I want it to, so unfortunately for me, your comments are way over my level of ability to understand what your saying.

And there is a second bit of code that allows a selection of pages to printed that I haven't posted. I had figured that I might have been able to cut and paste any changes between the two lots of code.

As to using the Visual part of VBA - I started heading down that road but the 'tutorials' ended up, again, going over my head so I gave that idea away.

Having said that - thanks for the reply - much appreciated.
Reply With Quote
  #3  
Old 05-23-2018, 02:59 AM
slaycock slaycock is offline SENDKEYS with vbYesNoCancel and Select Case Windows 7 64bit SENDKEYS with vbYesNoCancel and Select Case Office 2016
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

You might know more than you think. If you have enough knowledge to get as far as opening the VBA IDE and tinkering with code then you have enough knowledge to have a go at at least trying to create a form.

Lets assume that you want a simple form that has two input boxes and two buttons (OK and Cancel).

In the VBA IDE use

Insert.UserForm

This will open up a page that displays an empty userform.

You will also see in the 'Properties' window a set of properties available to the form.

Change the Name to 'ufrmPrintNumberedCopies'
Change the Caption to 'Print Numbered Copies'

When you change the caption text what you entered should appear in the blue bar at the top of the user form.

See if you can get this far. If you can then with a small amount of guidance it should be perfectly possible for you to revise your code to use a user dialog box.

If you don't see a properties windows (usually in the bottom left corner of the screen) then you will need to enable its display.

inthe VBA IDE

View.Properties Window
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Case and Select case brent chadwick Word VBA 34 10-18-2015 02:13 PM
Replace & case Jennifer Murphy Word 1 02-11-2013 03:26 AM
SENDKEYS with vbYesNoCancel and Select Case A macro that can insert FILENAME, sendkeys CTRL ALT T, paste clipboard, and nextline kyjac85 Word VBA 13 09-20-2012 05:00 PM
Problem with the sendkeys in Win7 vidyapakki Excel Programming 1 05-07-2012 11:10 PM
SENDKEYS with vbYesNoCancel and Select Case From all UPPER CASE to Proper Case davers Word 1 04-30-2009 12:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:45 AM.


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