Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ned ned is offline
external usenet poster
 
Posts: 3
Default using a input box

I have a simple macro for users to click on a command button that prints out
2 sheets. I want to add code when the button is click, a box pops up to
have them type their name. Their name is in the footer along with today's
date. The macro then will continue on with printing the sheets. Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using a input box


Add this to your code:

Dim strName As String
strName = InputBox("Please enter your name.", "Name")

'
' -- Uncomment and use whichever footers you wish
'
'ActiveSheet.PageSetup.LeftFooter = ""
ActiveSheet.PageSetup.CenterFooter = strName & " " & Now
'ActiveSheet.PageSetup.RightFooter = ""

'Add your code to print here



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26661

  #3   Report Post  
Posted to microsoft.public.excel.programming
ned ned is offline
external usenet poster
 
Posts: 3
Default using a input box

what if I want a input box to pop up when I open up a certain workbook.
Here's the code I have so far, but it's not working. I can get it to work
if I run it manually within excel.

Private Sub WorkbookOpen()
Dim strname As String
strname = InputBox("Please type in your name.", "Name")
MsgBox ("Hey " & strname & "! " & "Fill in the yellow cells only")
End Sub


"kkknie" wrote in message
...

Add this to your code:

Dim strName As String
strName = InputBox("Please enter your name.", "Name")

'
' -- Uncomment and use whichever footers you wish
'
'ActiveSheet.PageSetup.LeftFooter = ""
ActiveSheet.PageSetup.CenterFooter = strName & " " & Now
'ActiveSheet.PageSetup.RightFooter = ""

'Add your code to print here

K


--
kkknie
------------------------------------------------------------------------
kkknie's Profile:

http://www.excelforum.com/member.php...fo&userid=7543
View this thread: http://www.excelforum.com/showthread...hreadid=266614



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default using a input box

Hi Ned,

Here's the code I have so far, but it's not working. I can get it to work
if I run it manually within excel.


Where did you put the code?

It should be in the workbook's ThisWorbook module. You can access this
module by right-clicking the Excel icon at the extreme left of the Menu
toolbar and selecting View Code.

Your code worked for me, providing that it was housed in the correct module.

--
Regards,
Norman



"ned" wrote in message
...
what if I want a input box to pop up when I open up a certain workbook.
Here's the code I have so far, but it's not working. I can get it to work
if I run it manually within excel.

Private Sub WorkbookOpen()
Dim strname As String
strname = InputBox("Please type in your name.", "Name")
MsgBox ("Hey " & strname & "! " & "Fill in the yellow cells only")
End Sub


"kkknie" wrote in message
...

Add this to your code:

Dim strName As String
strName = InputBox("Please enter your name.", "Name")

'
' -- Uncomment and use whichever footers you wish
'
'ActiveSheet.PageSetup.LeftFooter = ""
ActiveSheet.PageSetup.CenterFooter = strName & " " & Now
'ActiveSheet.PageSetup.RightFooter = ""

'Add your code to print here

K


--
kkknie
------------------------------------------------------------------------
kkknie's Profile:

http://www.excelforum.com/member.php...fo&userid=7543
View this thread:
http://www.excelforum.com/showthread...hreadid=266614





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using a input box


Norman is absolutely correct. What you are doing is running an even
procedure, which is a bit complicated to explain. An event procedur
runs when something happens (in your case, the workbook being opened)
It must be put in the correct place (i.e. the workbook section o
code).

I did notice that your post had WorkbookOpen as the name of th
routine. An event procedure for opening the workbook would be calle
Workbook_Open (notice the underscore). The easiest way to check fo
what event procedures are available is to go to the specific code are
(either a worksheet or the workbook) and click on the left-most dro
down at the top of the screen. In the ThisWorkbook module, if yo
select Workbook from the left drop down, it will give you all of th
events that are associated with the workbook.

Post back with more questions.



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26661



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default using a input box

On Tue, 5 Oct 2004 15:55:09 -0700, "ned" wrote:

Private Sub WorkbookOpen()


Needs to have an underscore......Private Sub Workbook_Open()

Gord Dibben Excel MVP

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
How to input pictures automatically based on cell input? bsharp Excel Worksheet Functions 9 May 30th 09 07:16 AM
input in number form is being multiplied by 1000 when i input. jweinograd Excel Discussion (Misc queries) 4 April 16th 07 11:18 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
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
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 08:46 AM.

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"