Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to input pictures automatically based on cell input? | Excel Worksheet Functions | |||
input in number form is being multiplied by 1000 when i input. | Excel Discussion (Misc queries) | |||
Have user input converted to uppercase in same cell as input? | New Users to Excel | |||
How do I add input data in the input ranges in drop down boxes. | Excel Discussion (Misc queries) | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming |