Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.



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
Time with VBA code Dale G[_2_] Excel Discussion (Misc queries) 8 September 23rd 09 11:22 PM
Time code albertmb Excel Discussion (Misc queries) 0 February 23rd 09 11:59 AM
On Time code kevin Excel Programming 4 February 17th 05 09:01 AM
Time Code Greg Brow Excel Programming 2 February 11th 05 12:19 PM
Same VBA code, different run time Bill Li Excel Programming 1 October 14th 03 06:04 AM


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

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

About Us

"It's about Microsoft Excel"