Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Saving A File

I am creating a template to be used to prompt for the following:
Enter RequestorName
Enter RequestDate in mmddyy format
Then have the file automatically save if possible,but use Save As since this
is a template.
So the file should appear like this within a folder: John Doe 041505

How would I code this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Saving A File

You can learn how to do this by first recording the macro and then looking
in help for INPUTBOX and then combining. post your macro back here for more
assistance, if needed.

--
Don Guillett
SalesAid Software

"CyndyG" wrote in message
...
I am creating a template to be used to prompt for the following:
Enter RequestorName
Enter RequestDate in mmddyy format
Then have the file automatically save if possible,but use Save As since

this
is a template.
So the file should appear like this within a folder: John Doe 041505

How would I code this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Saving A File

If the requestor name is the same as the computer's user name and the data is
today's, you can do this without input boxes. Try:

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Sub SaveAs()
Dim UserName As String, FileName As String
UserName = String(100, Chr$(0))
GetUserName UserName, 100
UserName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)
FileName = UserName & Format(Date, "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=FileName
End Sub

NOTE: the filename should not exist already (you could consider using the
current time in the file name).

"CyndyG" wrote:

I am creating a template to be used to prompt for the following:
Enter RequestorName
Enter RequestDate in mmddyy format
Then have the file automatically save if possible,but use Save As since this
is a template.
So the file should appear like this within a folder: John Doe 041505

How would I code this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Saving A File

There is an easier way to get the network user name:

Sub SaveAs()
Dim UserName As String, FileName As String
UserName = Environ("UserName")
FileName = UserName & Format(Date, "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=FileName
End Sub

It does not require the API call and makes the code a little cleaner. I used
to use the API but have abandoned it in favour of this...

HTH

"AA2e72E" wrote:

If the requestor name is the same as the computer's user name and the data is
today's, you can do this without input boxes. Try:

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Sub SaveAs()
Dim UserName As String, FileName As String
UserName = String(100, Chr$(0))
GetUserName UserName, 100
UserName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)
FileName = UserName & Format(Date, "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=FileName
End Sub

NOTE: the filename should not exist already (you could consider using the
current time in the file name).

"CyndyG" wrote:

I am creating a template to be used to prompt for the following:
Enter RequestorName
Enter RequestDate in mmddyy format
Then have the file automatically save if possible,but use Save As since this
is a template.
So the file should appear like this within a folder: John Doe 041505

How would I code this?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Saving A File

No how to create a macro. Guess I didn't do a very godd job of explaining
what I want. Thanks anyway.

"Don Guillett" wrote:

You can learn how to do this by first recording the macro and then looking
in help for INPUTBOX and then combining. post your macro back here for more
assistance, if needed.

--
Don Guillett
SalesAid Software

"CyndyG" wrote in message
...
I am creating a template to be used to prompt for the following:
Enter RequestorName
Enter RequestDate in mmddyy format
Then have the file automatically save if possible,but use Save As since

this
is a template.
So the file should appear like this within a folder: John Doe 041505

How would I code this?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Saving A File

Fillenames will never be the same as the username that is logging in. THese
for people who are requesting some items to be sent to them. Need to keep
track of what was sent to them . Thanks anyway.

"AA2e72E" wrote:

If the requestor name is the same as the computer's user name and the data is
today's, you can do this without input boxes. Try:

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Sub SaveAs()
Dim UserName As String, FileName As String
UserName = String(100, Chr$(0))
GetUserName UserName, 100
UserName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)
FileName = UserName & Format(Date, "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=FileName
End Sub

NOTE: the filename should not exist already (you could consider using the
current time in the file name).

"CyndyG" wrote:

I am creating a template to be used to prompt for the following:
Enter RequestorName
Enter RequestDate in mmddyy format
Then have the file automatically save if possible,but use Save As since this
is a template.
So the file should appear like this within a folder: John Doe 041505

How would I code this?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Saving A File

THanks Jim,but it has nothing to do with the network username.

"Jim Thomlinson" wrote:

There is an easier way to get the network user name:

Sub SaveAs()
Dim UserName As String, FileName As String
UserName = Environ("UserName")
FileName = UserName & Format(Date, "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=FileName
End Sub

It does not require the API call and makes the code a little cleaner. I used
to use the API but have abandoned it in favour of this...

HTH

"AA2e72E" wrote:

If the requestor name is the same as the computer's user name and the data is
today's, you can do this without input boxes. Try:

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Sub SaveAs()
Dim UserName As String, FileName As String
UserName = String(100, Chr$(0))
GetUserName UserName, 100
UserName = Left$(UserName, InStr(UserName, Chr$(0)) - 1)
FileName = UserName & Format(Date, "mmddyy") & ".xls"
ActiveWorkbook.SaveAs FileName:=FileName
End Sub

NOTE: the filename should not exist already (you could consider using the
current time in the file name).

"CyndyG" wrote:

I am creating a template to be used to prompt for the following:
Enter RequestorName
Enter RequestDate in mmddyy format
Then have the file automatically save if possible,but use Save As since this
is a template.
So the file should appear like this within a folder: John Doe 041505

How would I code this?

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
Saving Excel 2007 file in 2003 creates very large file Jon Pearce Excel Discussion (Misc queries) 2 July 16th 09 07:20 PM
Saving worksheet in new file with date AND cell value as file name michaelberrier Excel Discussion (Misc queries) 4 May 26th 06 08:05 PM
Excel should let me sort the file directory when saving a file Beanee70 Excel Discussion (Misc queries) 0 March 14th 06 07:03 AM
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM
saving an excel file as an ASCII text file without delimiters Sewellst Excel Programming 4 January 7th 05 01:41 PM


All times are GMT +1. The time now is 02:53 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"