Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default run macro in workbook open event once only

hey...

okay.. almost done with this workbook.

ive been able to get alot of help through this discusions.. thanx every1

one more thing...

ive got this code in my workbook open thingie

Select Case Sheets("data").Range("A111").Value
Case "a"
Application.Run "editINVENTRY.xls!download.download"
End Select


and to get the "a" i use this in the worksheet code

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("data").Range("A111").Value = "A"
End Sub

this all are working good and briljant.. THANX TO ALL THAT HELPED!!!!

but now when the authorised user make changes to the sheet and get the "A"
like needed and then mail to the other users. they then open it and the
download macro update their inventry.

where and what code would i use to get the "editINVENTRY.xls" to not run on
the authorised users computer? in other words when she go in again to change
anything els the "a" is still there

all the users in our company are born BC (before computers) so to tell her
to hit escape and del the a and then edit what needed be would not work..

thanx again every1

Phillip


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default run macro in workbook open event once only

Hi,

You need to create a marker file, try this:-

Private Sub Workbook_Open()
RunOnce = "C:\" & "Runonce.Log"
If Dir(RunOnce) = Empty Then
Open RunOnce For Output As #1
Close #1
'your code here
Else
Exit Sub
End If
End Sub

The first time this runs it creates a logfile in the root of C (Change to
suit) if the marker file exists then the routine exits.

Mike
"pswanie" wrote:

hey...

okay.. almost done with this workbook.

ive been able to get alot of help through this discusions.. thanx every1

one more thing...

ive got this code in my workbook open thingie

Select Case Sheets("data").Range("A111").Value
Case "a"
Application.Run "editINVENTRY.xls!download.download"
End Select


and to get the "a" i use this in the worksheet code

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("data").Range("A111").Value = "A"
End Sub

this all are working good and briljant.. THANX TO ALL THAT HELPED!!!!

but now when the authorised user make changes to the sheet and get the "A"
like needed and then mail to the other users. they then open it and the
download macro update their inventry.

where and what code would i use to get the "editINVENTRY.xls" to not run on
the authorised users computer? in other words when she go in again to change
anything els the "a" is still there

all the users in our company are born BC (before computers) so to tell her
to hit escape and del the a and then edit what needed be would not work..

thanx again every1

Phillip


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default run macro in workbook open event once only

thanx mike but keep in mind that on the other users computers the macro
"download" has to run everytime they open the workbook wich come as a
attachement of a email in outlook. its only on the authorised users computer
that it needs to and has to ignore the "A"

so basicly has to check if it is a attachement then check if "A" is in if
not a attachment then dont chek for "A". the file on the authorised users
computer are called "editINVENTRY" and the attachement the exact same name.

the file that exits on all the computers are
c:/pswanie/inventry/inventry.xls and the download hapens from
editINVENTRY.xls to inventry.xls. dbl click the attached editINVENTRY.xls
and the update hapens without any user input. when done the workbook exits
completly. users then delete the email from outlook when done.

"Mike H" wrote:

Hi,

You need to create a marker file, try this:-

Private Sub Workbook_Open()
RunOnce = "C:\" & "Runonce.Log"
If Dir(RunOnce) = Empty Then
Open RunOnce For Output As #1
Close #1
'your code here
Else
Exit Sub
End If
End Sub

The first time this runs it creates a logfile in the root of C (Change to
suit) if the marker file exists then the routine exits.

Mike
"pswanie" wrote:

hey...

okay.. almost done with this workbook.

ive been able to get alot of help through this discusions.. thanx every1

one more thing...

ive got this code in my workbook open thingie

Select Case Sheets("data").Range("A111").Value
Case "a"
Application.Run "editINVENTRY.xls!download.download"
End Select


and to get the "a" i use this in the worksheet code

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("data").Range("A111").Value = "A"
End Sub

this all are working good and briljant.. THANX TO ALL THAT HELPED!!!!

but now when the authorised user make changes to the sheet and get the "A"
like needed and then mail to the other users. they then open it and the
download macro update their inventry.

where and what code would i use to get the "editINVENTRY.xls" to not run on
the authorised users computer? in other words when she go in again to change
anything els the "a" is still there

all the users in our company are born BC (before computers) so to tell her
to hit escape and del the a and then edit what needed be would not work..

thanx again every1

Phillip


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
Macro doesn't work when used as Workbook Open event Phil Excel Discussion (Misc queries) 2 October 20th 06 02:42 PM
Workbook open event [email protected] Excel Programming 1 June 11th 06 10:57 AM
Insert VBA code with a macro in a .xls file by workbook open event mihai[_3_] Excel Programming 8 July 29th 04 01:49 PM
Workbook Open Event Stuart[_5_] Excel Programming 1 July 6th 04 08:47 PM
Workbook Open event Todd Huttenstine Excel Programming 1 April 21st 04 07:06 PM


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