Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
(Disable macro's while) using the GetObject
Hi all,
I have a piece of code which opens an excel file ("Optellen.xls") (this file has code in it, also in the Workbook_Open). When I run the code which opens Optellen.xls, the debugger debugs in Optellen.xls???. How is this possible, does it run the VB code in Opt...xls as well??? QUESTION: How can I make sure, that my code just opens Optellen.xls, but (probably thats the problem) without enabling it's macro's? Here's my code: Public Sub BatchNames() ' Dim Wrb As Excel.Workbook ' Set Wrb = GetObject("C:\Documents and Settings\Max\Desktop\Rekenprogramma\Optellen.xls") ' Wrb.Unprotect (my password) ' filepath = "C:\Documents and Settings\Max\Desktop\temp" Filename = "namen.xls" sheetname = "Sheet1" Wrb.Sheets("Leraar").Range("A2:A18").ClearContents ' For n = 2 To 36 Wrb.Sheets("Leraar").Cells(n, 2).Value = 1 Wrb.Sheets("Leraar").Cells(n, 4).Value = 0 Next n ' For n = 2 To 15 Strg = "'" & filepath & "\[" & Filename & "]" _ & sheetname & "'!" & "r" & n - 1 & "c1" MsgBox "Strg = " & Strg 'just a test Wrb.Sheets("Leraar").Cells(n, 1).Value = ExecuteExcel4Macro(Strg) Next n ' Wrb.Save ' Wrb.Close ' Set Wrb = Nothing ' End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatically disable macro's on new doc | Excel Discussion (Misc queries) | |||
don't let the user disable macro's in Excel | Excel Programming | |||
Disable AutoOpen macro's | Excel Programming | |||
enable/disable macro's dialog? | Excel Programming |