ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get user inputs (https://www.excelbanter.com/excel-programming/441808-get-user-inputs.html)

C

Get user inputs
 
I have a workbook that opens up upon macro run. It opens up in Read Only and
would like to prompt the user to save the file at this point. Once they have
saved the workbook under a new name I would like to delect the original file
located at c:\Sales.xls. I would also like to ask the user to Enter the
start date in MMM YY and end date MMM YY. Then starting in cell E1 Enter the
reporting period they specified.

Can someone help me out with the code to do this?

Thanks in advance.



Gary Brown[_6_]

Get user inputs
 
To open up the SaveAs dialog...
Application.Dialogs(xlDialogSaveAs).Show

To delete original file...
- get the filename before doing a SaveAs

Dim strFilename as string
'save current file name [to be deleted]
strFilename = ActiveWorkbook.FullName
'Save the file as a different name / location
Application.Dialogs(xlDialogSaveAs).Show
'Delete the original file
Kill strFilename

To put start / stop date in cell 'E1'
ActiveSheet.Range("E1").Value = _
"'" & InputBox("Enter Start Date (mmm yy):")
ActiveSheet.Range("E1").Value = _
ActiveSheet.Range("E1").Value & " - " & _
InputBox("Enter End Date (mmm yy):")

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"C" wrote:

I have a workbook that opens up upon macro run. It opens up in Read Only and
would like to prompt the user to save the file at this point. Once they have
saved the workbook under a new name I would like to delect the original file
located at c:\Sales.xls. I would also like to ask the user to Enter the
start date in MMM YY and end date MMM YY. Then starting in cell E1 Enter the
reporting period they specified.

Can someone help me out with the code to do this?

Thanks in advance.




All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com