Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Help replaceing input boxes the custom forms

I'm trying to replace my input boxes the custom forms. I have created
the form. I just don't know how to take the value inputted and get it
to my existing code.

Custom form code.

Private Sub cmdClose_Click()

' This Unloads the Address form and
' makes the address worksheet the
' active window.

Unload Me
Sheets("Pieces").Activate
End Sub


Private Sub cmdOK_Click()

End Sub


' Current code with input boxes


Sub doprint()
'
' doprint Macro


Dim i As Integer
Dim oCell As Range
Dim cCell As Range
Dim p As Long

strjobnumber = Application.InputBox("Start in Job Number?", "
First Job to Print", 0)
If strjobnumber = False Then Exit Sub
endjobnumber = Application.InputBox("Finish in Job Number?", "
Last Job to Print", 0)
If endjobnumber = False Then Exit Sub

Range("I40").Select
Range("I41").Select


For counter = strjobnumber To endjobnumber
Application.ScreenUpdating = False
Sheets("Pieces").Activate
Range("L5").Value = counter
Range("J85").Select
c = ActiveCell.Value

If c < 100 Then GoTo NextCounter

Range("J80").Select
p = ActiveCell.Value
Sheets(Array("BatchSheet1", "BatchSheet2", "BatchSheet3",
"BatchSheet4", _
"BatchSheet5", "BatchSheet6", "BatchSheet7", "BatchSheet8",
"BatchSheet9", _
"BatchSheet10", "BatchSheet11", "BatchSheet12",
"BatchSheet13", "BatchSheet14", _
"BatchSheet15", "BatchSheet16", "BatchSheet17",
"BatchSheet18", "BatchSheet19", _
"BatchSheet20")).Select
Sheets("BatchSheet1").Activate
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=p,
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
NextCounter:
Next counter
Sheets("Pieces").Activate
Range("$A$1").Select

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Help replaceing input boxes the custom forms


Little Penny wrote:
I'm trying to replace my input boxes the custom forms. I have created
the form. I just don't know how to take the value inputted and get it
to my existing code.

Custom form code.

Private Sub cmdClose_Click()

' This Unloads the Address form and
' makes the address worksheet the
' active window.

Unload Me
Sheets("Pieces").Activate
End Sub


Private Sub cmdOK_Click()

End Sub


' Current code with input boxes


Sub doprint()
'
' doprint Macro


Dim i As Integer
Dim oCell As Range
Dim cCell As Range
Dim p As Long

strjobnumber = Application.InputBox("Start in Job Number?", "
First Job to Print", 0)
If strjobnumber = False Then Exit Sub
endjobnumber = Application.InputBox("Finish in Job Number?", "
Last Job to Print", 0)
If endjobnumber = False Then Exit Sub

Range("I40").Select
Range("I41").Select


For counter = strjobnumber To endjobnumber
Application.ScreenUpdating = False
Sheets("Pieces").Activate
Range("L5").Value = counter
Range("J85").Select
c = ActiveCell.Value

If c < 100 Then GoTo NextCounter

Range("J80").Select
p = ActiveCell.Value
Sheets(Array("BatchSheet1", "BatchSheet2", "BatchSheet3",
"BatchSheet4", _
"BatchSheet5", "BatchSheet6", "BatchSheet7", "BatchSheet8",
"BatchSheet9", _
"BatchSheet10", "BatchSheet11", "BatchSheet12",
"BatchSheet13", "BatchSheet14", _
"BatchSheet15", "BatchSheet16", "BatchSheet17",
"BatchSheet18", "BatchSheet19", _
"BatchSheet20")).Select
Sheets("BatchSheet1").Activate
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=p,
Copies:=1, Collate _
:=True
Application.ScreenUpdating = True
NextCounter:
Next counter
Sheets("Pieces").Activate
Range("$A$1").Select

End Sub


Hi Little Penny,

You could probably just assign the values of the text boxes on your
user form to some variables in the same module as your print code. For
an example . . .

'User Form Code
Private Sub CommandButton1_Click()
myVar1 = TextBox1.Text
myVar2 = TextBox2.Text
Unload Me
End Sub

'Code Module
Dim myVar1 As String
Dim myVar2 As String

Sub printJob()
'I guess go ahead now and convert to integer if that's what you want .
.. .
myVar1 = CInt(myVar1)
myVar2 = CInt(myVar2)
'Now you've got the values from the User Form stored in your printJob
module so you can
'use them in place of the values from your input boxes.
End Sub

Does this help?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding custom list and text boxes to the custom tool bar from Excel C API Mousam Excel Discussion (Misc queries) 0 August 7th 07 09:19 AM
Boxes in Forms PaulW Excel Discussion (Misc queries) 0 March 10th 06 03:18 PM
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
Forms - Dropdown Boxes Olivia Excel Programming 0 November 18th 04 09:43 PM
Mask input in input boxes? Eric[_14_] Excel Programming 4 November 29th 03 11:10 AM


All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"