ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically generate a unique file name via macro... (https://www.excelbanter.com/excel-programming/271968-re-automatically-generate-unique-file-name-via-macro.html)

John Green[_2_]

Automatically generate a unique file name via macro...
 
Ian,

The following version of your code should work OK:

Thisworkbook.SaveAs "X:\SpecialFolder\ ABC" & _
Format(Now,"yyyymmdd_hhmm") & ".xls"


--

John Green - Excel MVP
Sydney
Australia


"Ian L." wrote in message ...
I have an excel (XP version) application in use on a
network. The app is being run by 50+ different users,
and currently they output the final result sheet to a
printer on completion.

I would like to save some trees and instead of printing
the output, I would like to save it to a folder on the
network. The problem is, each user prints between 5 &
10 of these sheets per shift.

Not all of the users are computer savvy, so in order to
avoid everyone saving their files over everyone elses, I
would need to write a macro that would save the file
automatically to a specific folder. At the same time it
would also need to generate a unique file name for each
individual user!

Does anyone know if this is possible, and can you give me
any pointers please?

I tried something like this:

Thisworkbook.SaveAs "X:\SpecialFolder\ & "ABC" & _
format(now,"yyyymmdd_hhmm") & ".xls"

but I get syntax errors or expected end of statement
errors.

Thanks in advance.

Ian.





Randall Arnold[_3_]

Automatically generate a unique file name via macro...
 
I completely overlooked the missing quotes!

That'll teach me not to answer in a rush...

; )

Randall

"Ian L" wrote in message
...
Thanks everyone. I'll give it another try.

Ian ;o)

-----Original Message-----
Ian,

The following version of your code should work OK:

Thisworkbook.SaveAs "X:\SpecialFolder\ ABC" & _
Format(Now,"yyyymmdd_hhmm") & ".xls"


--

John Green - Excel MVP
Sydney
Australia


"Ian L." wrote in message

...
I have an excel (XP version) application in use on a
network. The app is being run by 50+ different users,
and currently they output the final result sheet to a
printer on completion.

I would like to save some trees and instead of printing
the output, I would like to save it to a folder on the
network. The problem is, each user prints between 5 &
10 of these sheets per shift.

Not all of the users are computer savvy, so in order to
avoid everyone saving their files over everyone elses,

I
would need to write a macro that would save the file
automatically to a specific folder. At the same time

it
would also need to generate a unique file name for each
individual user!

Does anyone know if this is possible, and can you give

me
any pointers please?

I tried something like this:

Thisworkbook.SaveAs "X:\SpecialFolder\ & "ABC" & _
format(now,"yyyymmdd_hhmm") & ".xls"

but I get syntax errors or expected end of statement
errors.

Thanks in advance.

Ian.




.





All times are GMT +1. The time now is 01:48 PM.

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