PC Review


Reply
Thread Tools Rate Thread

Count the times a file is opened

 
 
mrlanier@hotmail.com
Guest
Posts: n/a
 
      22nd Dec 2006
Can Excel count the number of times a file has been opened and place
the count in cell A1? I thought I had a solution when someone
suggested the following response, but I couldn't get it to execute.
Does anyone else have any suggestions? Thanks. Michael

You could use a Workbook_Open event thus

Private Sub Workbook_Open()
Worksheets("Tracker").Range("A1").Value = _
Worksheets("Tracker").Range("A1").Value + 1
End Sub


This put the value in A1 on a sheet called tracker, remember users have
a
habit of changing or deleting stuff, so you may want to hide the
worksheet.
To implement, right click on the small Excel icon for the workbook and
select view code. Paste the code here, save and close

 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      22nd Dec 2006
Michael,
Is the code in the correct place ?
On the ThisWorkbook module.

And are events enabled ?
In the Immediate panes, what does this return
?Application.EnableEvents

NickHK

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Can Excel count the number of times a file has been opened and place
> the count in cell A1? I thought I had a solution when someone
> suggested the following response, but I couldn't get it to execute.
> Does anyone else have any suggestions? Thanks. Michael
>
> You could use a Workbook_Open event thus
>
> Private Sub Workbook_Open()
> Worksheets("Tracker").Range("A1").Value = _
> Worksheets("Tracker").Range("A1").Value + 1
> End Sub
>
>
> This put the value in A1 on a sheet called tracker, remember users have
> a
> habit of changing or deleting stuff, so you may want to hide the
> worksheet.
> To implement, right click on the small Excel icon for the workbook and
> select view code. Paste the code here, save and close
>



 
Reply With Quote
 
mrlanier@hotmail.com
Guest
Posts: n/a
 
      22nd Dec 2006
Nick. Thanks for your response, especially since I believe it was from
you that I got the macro. I can get it to work on a blank workbook,
but I have a project that I've been working on for sometime, on which
it doesn't want to work. I wonder if it is because I have a "splash."
I have it in the ThisWorkbook module, but I also have a macro for the
splash there. Following is a copy. Is it wrong to have both there.
As you can tell, I'm still pretty new at macros. Thanks again for your
help. Michael

Private Sub Workbook_Open()
UserForm1.Show
End Sub

Private Sub Workbook_Open()
Worksheets("Instructions").Range("M1").Value = _
Worksheets("Instructions").Range("M1").Value + 1
End Sub


NickHK wrote:
> Michael,
> Is the code in the correct place ?
> On the ThisWorkbook module.
>
> And are events enabled ?
> In the Immediate panes, what does this return
> ?Application.EnableEvents
>
> NickHK
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Can Excel count the number of times a file has been opened and place
> > the count in cell A1? I thought I had a solution when someone
> > suggested the following response, but I couldn't get it to execute.
> > Does anyone else have any suggestions? Thanks. Michael
> >
> > You could use a Workbook_Open event thus
> >
> > Private Sub Workbook_Open()
> > Worksheets("Tracker").Range("A1").Value = _
> > Worksheets("Tracker").Range("A1").Value + 1
> > End Sub
> >
> >
> > This put the value in A1 on a sheet called tracker, remember users have
> > a
> > habit of changing or deleting stuff, so you may want to hide the
> > worksheet.
> > To implement, right click on the small Excel icon for the workbook and
> > select view code. Paste the code here, save and close
> >


 
Reply With Quote
 
mrlanier@hotmail.com
Guest
Posts: n/a
 
      22nd Dec 2006
Nick,

Success at last. I combined the macro for counting with the "splash"
macro to create a single sub routine. Both work perfectly together.
Thanks so very much for your help.

Michael

NickHK wrote:
> Michael,
> Is the code in the correct place ?
> On the ThisWorkbook module.
>
> And are events enabled ?
> In the Immediate panes, what does this return
> ?Application.EnableEvents
>
> NickHK
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Can Excel count the number of times a file has been opened and place
> > the count in cell A1? I thought I had a solution when someone
> > suggested the following response, but I couldn't get it to execute.
> > Does anyone else have any suggestions? Thanks. Michael
> >
> > You could use a Workbook_Open event thus
> >
> > Private Sub Workbook_Open()
> > Worksheets("Tracker").Range("A1").Value = _
> > Worksheets("Tracker").Range("A1").Value + 1
> > End Sub
> >
> >
> > This put the value in A1 on a sheet called tracker, remember users have
> > a
> > habit of changing or deleting stuff, so you may want to hide the
> > worksheet.
> > To implement, right click on the small Excel icon for the workbook and
> > select view code. Paste the code here, save and close
> >


 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      22nd Dec 2006
I am surprised that you did not get an error of "ambiguous name", as you
have 2 routine with the same name.
Just combine them together:

Private Sub Workbook_Open()
Worksheets("Instructions").Range("M1").Value = _
Worksheets("Instructions").Range("M1").Value + 1
UserForm1.Show
End Sub

NickHK

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Nick. Thanks for your response, especially since I believe it was from
> you that I got the macro. I can get it to work on a blank workbook,
> but I have a project that I've been working on for sometime, on which
> it doesn't want to work. I wonder if it is because I have a "splash."
> I have it in the ThisWorkbook module, but I also have a macro for the
> splash there. Following is a copy. Is it wrong to have both there.
> As you can tell, I'm still pretty new at macros. Thanks again for your
> help. Michael
>
> Private Sub Workbook_Open()
> UserForm1.Show
> End Sub
>
> Private Sub Workbook_Open()
> Worksheets("Instructions").Range("M1").Value = _
> Worksheets("Instructions").Range("M1").Value + 1
> End Sub
>
>
> NickHK wrote:
> > Michael,
> > Is the code in the correct place ?
> > On the ThisWorkbook module.
> >
> > And are events enabled ?
> > In the Immediate panes, what does this return
> > ?Application.EnableEvents
> >
> > NickHK
> >
> > <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Can Excel count the number of times a file has been opened and place
> > > the count in cell A1? I thought I had a solution when someone
> > > suggested the following response, but I couldn't get it to execute.
> > > Does anyone else have any suggestions? Thanks. Michael
> > >
> > > You could use a Workbook_Open event thus
> > >
> > > Private Sub Workbook_Open()
> > > Worksheets("Tracker").Range("A1").Value = _
> > > Worksheets("Tracker").Range("A1").Value + 1
> > > End Sub
> > >
> > >
> > > This put the value in A1 on a sheet called tracker, remember users

have
> > > a
> > > habit of changing or deleting stuff, so you may want to hide the
> > > worksheet.
> > > To implement, right click on the small Excel icon for the workbook and
> > > select view code. Paste the code here, save and close
> > >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Count numbers of times workbook opened =?Utf-8?B?SmltIFRob21saW5zb24=?= Microsoft Excel Programming 3 15th Jul 2009 07:50 PM
Can Outlook count number of times email was opened by recipient? mke_srba Microsoft Outlook Discussion 1 18th Jul 2008 05:32 AM
I need to be able to count the no. of times a sprdsheet is opened =?Utf-8?B?TWVsdmluIFA=?= Microsoft Excel Misc 2 22nd Jan 2007 11:16 AM
Count times report opened =?Utf-8?B?QmFycnk=?= Microsoft Access 2 12th Oct 2006 07:13 PM
Is it possible to count how many times a spreadsheet is opened ceepee Microsoft Excel Misc 2 2nd Apr 2004 02:00 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:35 PM.