Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to copy some date out of some xl files, the trouble is they have
Workbook_Open macro's & Links to other files, and I can't figure out how to open the files without being asked about upating the links, and then are the Workbook_Open macro's going to give me greif? How can I stop xl asking the questions? These are the first lines of code... fn & mth are supplied strings, for files I know exist Application.Calculation = xlCalculationManual Application.ScreenUpdating = False Application.EnableEvents = False Application.DisplayAlerts = False On Error Resume Next Set wbCVR = Workbooks(fn) 'Have I got file open? If wbCVR Is Nothing Then 'No - open it On Error GoTo 0 'if not able to open goto error Workbooks.Open Filename:=".\" & mth & "\" & fn, ReadOnly:=True, Notify:=False Set ws = ActiveWorkbook.Worksheets("By Staff") Else wbCVR.Activate 'Yes - use it Set ws = wbCVR.Worksheets("By Staff") End If TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With the .enableevents=false, you shouldn't have any trouble with any of the
events in the newly opened workbook. And take a look at workbooks.open in VBA's help. You'll see an option (Updatelinks:=0) that you can add to your line of code. Graham Y wrote: I need to copy some date out of some xl files, the trouble is they have Workbook_Open macro's & Links to other files, and I can't figure out how to open the files without being asked about upating the links, and then are the Workbook_Open macro's going to give me greif? How can I stop xl asking the questions? These are the first lines of code... fn & mth are supplied strings, for files I know exist Application.Calculation = xlCalculationManual Application.ScreenUpdating = False Application.EnableEvents = False Application.DisplayAlerts = False On Error Resume Next Set wbCVR = Workbooks(fn) 'Have I got file open? If wbCVR Is Nothing Then 'No - open it On Error GoTo 0 'if not able to open goto error Workbooks.Open Filename:=".\" & mth & "\" & fn, ReadOnly:=True, Notify:=False Set ws = ActiveWorkbook.Worksheets("By Staff") Else wbCVR.Activate 'Yes - use it Set ws = wbCVR.Worksheets("By Staff") End If TIA -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to stop running macros everytime I run excel? | Excel Discussion (Misc queries) | |||
How do I stop Excel from opening all files w/macros & running them | Excel Discussion (Misc queries) | |||
Running Macros without opening file. | Excel Programming | |||
Stop Macros from Running When Workbook Opened via Automation | Excel Programming | |||
opening and running macros in an Excel file in a new instance of Excel | Excel Programming |