Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2012, 08:31 PM
Authorized User
 
Join Date: Feb 2009
Posts: 25
Thanks: 11
Thanked 0 Times in 0 Posts
Default Printing to Word

I have a workbook which has 8 columns and 19 rows. The first row is headers.
The first column is "Assignments" and has 18 assignments from A2 to A19.
The second columns is "Saturday" and has 18 employee names from B2 to B19.
The third column is "Sunday"
and so forth until last column is "Friday"

What I want to do is have an input box that asks what day it is, then open a Word document and print both column "A" and, depending on what day is put in, the corresponding column.

The object is to make daily rosters with assignments for each employee on them, example Column "A" and Column "B" for Saturday, Column "A" and Column "C" for Sunday, and so on to Column "A" and Column "H" for Friday
I have got the inputbox to work and have done Select Case for whatever day is put in the box. Right now, I just have a msgbox for each day just to make sure my Select Case is working right. My code to follow:
Code:
Option Explicit
Sub MakeAssignments()
'/===================================================================
'/
'/===================================================================
Dim sAssign         As Integer
Dim sDay            As String
 
    sDay = InputBox("What day is it?", "Day Please!", "Enter Day Here!")
    If sDay = "" Then
Exit Sub
    Else
Select Case sDay
    Case "Saturday"
For sAssign = 1 To 18
    Debug.Print ThisWorkbook.Worksheets("Sheet1").Range("A1").Offset(sAssign, 1).Formula
Next
Case "Sunday"
    MsgBox "Yep, it's Sunday!", vbOKCancel, "Second Watch Operations"
Case "Monday"
    MsgBox "Yes, it's Monday!", vbOKCancel, "Second Watch Operations"
Case "Tuesday"
    MsgBox "It IS Tuesday!", vbOKCancel, "Second Watch Operations"
Case "Wednesday"
    MsgBox "I think it's Wednesday", vbOKCancel, "Second Watch Operations"
Case "Thursday"
    MsgBox "Well now, it could be Thursday!", vbOKCancel, "Second Watch Operations"
Case "Friday"
    MsgBox "Thank God, it's Friday!", vbOKCancel, "Second Watch Operations"
End Select
 
    End If
End Sub
Could someone help with the rest?
Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
printing a word doc from badgolfer ASP.NET 1.0 and 1.1 Basics 2 December 13th, 2013 07:06 AM
Disable Word printing progress dialog gattsi VB How-To 1 March 19th, 2007 05:08 AM
Printing specific pages from Word 2000 jpmhughes Beginning VB 6 5 April 30th, 2005 06:35 PM
Printing To Word Doc kekohchaa VS.NET 2002/2003 0 May 7th, 2004 03:35 AM
printing word document joshivadiraj VB How-To 1 December 11th, 2003 06:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.