Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Button to saveas then new sheet asks Questions

I want to create a button to saveas the current sheet.

when the user a enters a file name it is saved, then the template file (ie
EWR blank.xls) opens and asks the user questions that will go in pre
determined cells.

example.

work order #
Forman
date
work start
work finish
EWR#

I want these questions asked when the sheet is opened.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 207
Default Button to saveas then new sheet asks Questions

Marc,
I can get you started on your project.
This is what I came up with:
On your template file, right-click on the first sheet (in my case Sheet1)
and select "view code"
Type the following "Option Explicit", then press "Enter".
In the upper part of the Visual Basic Editor window you will see "(General)"
on the left, and "(Declarations)" on the right.
Select down arrow next to "(General)" and select "Worksheet". On the
right-hand side, select down arrow and select "Activate".
This will automatically put in the empty space:
"Private Sub Worksheet_Activate()

End Sub"

Now make it look like this:
"Private Sub Worksheet_Activate()
MsgBox "Welcome to EWR blank.xls !"
Dim workordernum As String, Foreman As String
Dim Today As Date, workstart As Date, workfinish As Date
Dim EWRnum As Long

workordernum = InputBox("Work Order # ?")
Foreman = InputBox("Foreman ?")
Today = InputBox("Date (mm/dd/yy)?")
workstart = InputBox("Work start (mm/dd/yy hh:mm)?")
workfinish = InputBox("Work finish (mm/dd/yy) ?")
EWRnum = InputBox("EWR # ?")

Worksheets("Sheet1").Activate
Range("A10").Select
ActiveCell.FormulaR1C1 = workordernum

Range("B10").Select
ActiveCell.FormulaR1C1 = Foreman

Range("C10").Select
ActiveCell.FormulaR1C1 = Today
Selection.NumberFormat = "mm/dd/yy hh:mm"

Range("A13").Select
ActiveCell.FormulaR1C1 = workstart
Selection.NumberFormat = "mm/dd/yy hh:mm"

Range("B13").Select
ActiveCell.FormulaR1C1 = workfinish
Selection.NumberFormat = "mm/dd/yy hh:mm"

Range("D10").Select
ActiveCell.FormulaR1C1 = EWRnum




End Sub"
Without the first and last " marks.
You can change the Range("cell") to what ever you want them to be.

I will need more information to work on the SaveAs part of your question.
Like what name do want to call the file,"current sheet" does not work.
Can you give me an example of what to call it?
hth


"Marc" wrote:

I want to create a button to saveas the current sheet.

when the user a enters a file name it is saved, then the template file (ie
EWR blank.xls) opens and asks the user questions that will go in pre
determined cells.

example.

work order #
Forman
date
work start
work finish
EWR#

I want these questions asked when the sheet is opened.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Button to saveas then new sheet asks Questions

This is based on what the posting described. Some liberties were taken with
the predetermined range assignment, but those can be adjusted as needed.
Also, when the file name is entered for saving, they should not include the
file extension (.xls) since that will be automatically added during the
saveas execution.

Sub workstuff()
Dim sh As Worksheet, fName As String
Set sh = Workbooks("EWR blank.xls").Sheets("Sheet1")
fName = InputBox("Enter a File Name", "FILE NAME")
Range("a2") = InputBox("Enter a Work Order Number", "WO NUMBER")
Range("b2") = InputBox("Enter the Foreman's Name", "FOREMAN NAME")
Range("c2") = InputBox("Enter the Date Performed", "DATE PERFORMED")
Range("d2") = InputBox("Enter the Time Started", "START TIME")
Range("e2") = InputBox("Enter the Time Finished", "FINISH TIME")
Range("f2") = InputBox("Enter the EWR Number", "EWR NUMBER")
ActiveWorkbook.SaveAs Filename:=fName & ".xls"
End Sub



"Marc" wrote in message
...
I want to create a button to saveas the current sheet.

when the user a enters a file name it is saved, then the template file (ie
EWR blank.xls) opens and asks the user questions that will go in pre
determined cells.

example.

work order #
Forman
date
work start
work finish
EWR#

I want these questions asked when the sheet is opened.



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
avoid message that asks for confirm delete sheet Craig Excel Programming 1 September 11th 09 01:56 PM
Macro button that asks for password before proceeding? Munchkin Excel Programming 6 August 5th 09 06:58 PM
thanks 2 everybody here who asks questions & answers them! Susan Excel Programming 0 January 17th 07 04:43 PM
How check for No/Cancel Button when SaveAs and file already exists? Joe HM Excel Programming 7 April 19th 05 10:53 AM
Spin button questions Norm[_5_] Excel Programming 3 July 28th 04 03:36 PM


All times are GMT +1. The time now is 07:57 PM.

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

About Us

"It's about Microsoft Excel"