Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
XL VB noobie needs help - macro opening file already in use prompt
Hi I have a macro that i have recorded that opens another file, makes some
changes and saves the file. problem i have is the file is stored on a shared drive and can be used by others, if the macro is run when someone else has the file open i would like it to stop and state that the file is in use (if possible stating who is already using but this isnt very important). i have listed the code below, my apologies for asking daft questions but i have very limited understanding of VB. :- Sub transfer1() ' ' transfer1 Macro ' Macro recorded 07/08/2006 by Bry ' ' Sheets("Do not touch").Visible = True Sheets("Do not touch2").Visible = True Sheets("Do not touch").Select Range("F15:F16").Select Range("F16").Activate Sheets("Query Logger").Select ChDir "S:\bry\QRYLOGMK2" Workbooks.Open Filename:="S:\bry\QRYLOGMK2\QRYLOGMK2.xls" ActiveWindow.LargeScroll ToRight:=-8 Range("A2").Select Selection.Copy Windows("INPUT FORM.xls").Activate Sheets("Do not touch").Select Range("A7").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Windows("QRYLOGMK2.xls").Activate Range("A2:BR2").Select Application.CutCopyMode = False Selection.Insert Shift:=xlDown Range("B2:BR2").Select Range("BR2").Activate Selection.Interior.ColorIndex = 2 Range("BR3").Select Selection.Copy Range("BR2").Select ActiveSheet.Paste Range("BQ2").Select Windows("INPUT FORM.xls").Activate Range("A13:BQ13").Select Application.CutCopyMode = False Selection.Copy Windows("QRYLOGMK2.xls").Activate Range("A2:BQ2").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Notes").Select Rows("1:1").Select Application.CutCopyMode = False Selection.Insert Shift:=xlDown Sheets("Sheet1").Select Range("A2").Select Selection.Copy Sheets("Notes").Select Range("A1").Select ActiveSheet.Paste Selection.Interior.ColorIndex = 2 Sheets("Sheet1").Select ActiveWorkbook.Save ActiveWorkbook.Close Sheets("Do not touch2").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Prompt message when opening a file | Excel Worksheet Functions | |||
Prompt Message when opening a file | Excel Worksheet Functions | |||
Dialog prompt during opening of file | New Users to Excel | |||
Prompt for file name in a macro | Excel Discussion (Misc queries) | |||
Autofilter macro for noobie | Excel Programming |