ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   First-time Use Code (https://www.excelbanter.com/excel-programming/342971-first-time-use-code.html)

pdberger

First-time Use Code
 
I would like to have an operation used the first time that a workbook is
opened, but not ever again after that. I know how to designate code that
runs when a workbook opens, but only once. I supposed I can 'brute force' it
by writing code that erases a button once it's clicked, but I'm hoping there
is something like a 'workbook-open' function.

Thanks in advance.

Jezebel[_3_]

First-time Use Code
 
Auto_New()


"pdberger" wrote in message
...
I would like to have an operation used the first time that a workbook is
opened, but not ever again after that. I know how to designate code that
runs when a workbook opens, but only once. I supposed I can 'brute force'
it
by writing code that erases a button once it's clicked, but I'm hoping
there
is something like a 'workbook-open' function.

Thanks in advance.




Bob Phillips[_6_]

First-time Use Code
 
Private Sub Workbook_Open()
On Error Resume Next
If Not Evaluate(ThisWorkbook.Names("___FirstTime").Refers To) Then
MsgBox "This is the first time"
ThisWorkbook.Names.Add Name:="___FirstTime", RefersTo:="=TRUE"
ThisWorkbook.Names("___FirstTime").Visible = False
ThisWorkbook.Save
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"pdberger" wrote in message
...
I would like to have an operation used the first time that a workbook is
opened, but not ever again after that. I know how to designate code that
runs when a workbook opens, but only once. I supposed I can 'brute force'

it
by writing code that erases a button once it's clicked, but I'm hoping

there
is something like a 'workbook-open' function.

Thanks in advance.




Dave Peterson

First-time Use Code
 
I think you meant: Auto_open()


Jezebel wrote:

Auto_New()

"pdberger" wrote in message
...
I would like to have an operation used the first time that a workbook is
opened, but not ever again after that. I know how to designate code that
runs when a workbook opens, but only once. I supposed I can 'brute force'
it
by writing code that erases a button once it's clicked, but I'm hoping
there
is something like a 'workbook-open' function.

Thanks in advance.


--

Dave Peterson


All times are GMT +1. The time now is 09:52 AM.

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