![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 02:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com