Prev: Excel 2007: Return rownumber when text data on 3 columns match exa
Next: Using VBA to change default color palette
From: Budget Programmer on 22 Jan 2010 10:24 Hello, For a year and a half I've had an Excel macro working fine. I haven't changed anything to the PC that would affect Excel, to my knowledge. I'm running Vista 32 Home Premium and Office 2007. I have the following references checked in "Tools / References": - Visual Basic for Applications - Microsoft Excel 12.0 Object Library - OLE Automation - Microsoft Office 12.0 Object Library This code runs on other PC's, but it stopped running on this (essential) one. When it encounters the first SET statement, it give the error: "Run-time error '429': ActiveX component can't create object" Sub CreateEditedSongListing() 'DECLARE VARIABLES Dim objFSO As Object Dim objFolder As Object Dim strSongs_EditedPath As String 'ASSIGN INITIAL VALUES strSongs_EditedPath = "C:\Users\Phil\Documents\Songbook On Screen\Songs-Edited" 'Use Microsoft Scripting runtime. Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strSongs_EditedPath) End Sub In which reference is the "Scripting.FileSystemObject" located? The code snipet runs fine on another PC, which has the same four references checked. However it stopped runing on the essential PC. Thanks for looking into this. Phil -- Programmer on Budget
From: Peter T on 22 Jan 2010 11:44 Maybe Scripting has been disabled by the administrator in that machine Regards, Peter T "Budget Programmer" <BudgetProgrammer(a)discussions.microsoft.com> wrote in message news:64948855-B022-42C2-942A-15FD8E3103BD(a)microsoft.com... > Hello, > > For a year and a half I've had an Excel macro working fine. I haven't > changed anything to the PC that would affect Excel, to my knowledge. > I'm running Vista 32 Home Premium and Office 2007. > I have the following references checked in "Tools / References": > - Visual Basic for Applications > - Microsoft Excel 12.0 Object Library > - OLE Automation > - Microsoft Office 12.0 Object Library > > This code runs on other PC's, but it stopped running on this (essential) > one. > When it encounters the first SET statement, it give the error: > "Run-time error '429': > ActiveX component can't create object" > > Sub CreateEditedSongListing() > 'DECLARE VARIABLES > Dim objFSO As Object > Dim objFolder As Object > Dim strSongs_EditedPath As String > > 'ASSIGN INITIAL VALUES > > strSongs_EditedPath = "C:\Users\Phil\Documents\Songbook On > Screen\Songs-Edited" > > 'Use Microsoft Scripting runtime. > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objFolder = objFSO.GetFolder(strSongs_EditedPath) > End Sub > > In which reference is the "Scripting.FileSystemObject" located? > The code snipet runs fine on another PC, which has the same four > references > checked. However it stopped runing on the essential PC. > Thanks for looking into this. > Phil > -- > Programmer on Budget
From: Budget Programmer on 22 Jan 2010 12:33 Peter, Are you speaking of Virus Protection Software or some other system setting? I'm not quite sure what you mean. I'm the only one that uses the machine, but maybe some update or something changed it. Where should I look? Thanks. Phil -- Programmer on Budget "Peter T" wrote: > Maybe Scripting has been disabled by the administrator in that machine > > Regards, > Peter T > > "Budget Programmer" <BudgetProgrammer(a)discussions.microsoft.com> wrote in > message news:64948855-B022-42C2-942A-15FD8E3103BD(a)microsoft.com... > > Hello, > > > > For a year and a half I've had an Excel macro working fine. I haven't > > changed anything to the PC that would affect Excel, to my knowledge. > > I'm running Vista 32 Home Premium and Office 2007. > > I have the following references checked in "Tools / References": > > - Visual Basic for Applications > > - Microsoft Excel 12.0 Object Library > > - OLE Automation > > - Microsoft Office 12.0 Object Library > > > > This code runs on other PC's, but it stopped running on this (essential) > > one. > > When it encounters the first SET statement, it give the error: > > "Run-time error '429': > > ActiveX component can't create object" > > > > Sub CreateEditedSongListing() > > 'DECLARE VARIABLES > > Dim objFSO As Object > > Dim objFolder As Object > > Dim strSongs_EditedPath As String > > > > 'ASSIGN INITIAL VALUES > > > > strSongs_EditedPath = "C:\Users\Phil\Documents\Songbook On > > Screen\Songs-Edited" > > > > 'Use Microsoft Scripting runtime. > > Set objFSO = CreateObject("Scripting.FileSystemObject") > > Set objFolder = objFSO.GetFolder(strSongs_EditedPath) > > End Sub > > > > In which reference is the "Scripting.FileSystemObject" located? > > The code snipet runs fine on another PC, which has the same four > > references > > checked. However it stopped runing on the essential PC. > > Thanks for looking into this. > > Phil > > -- > > Programmer on Budget > > > . >
From: Peter T on 22 Jan 2010 12:54 If you are the only user then it sounds like it has not been disabled. (Though it is one component admin's sometimes want to disable in a corporate environment). In Tools References look for "Microsoft Scripting Runtime" and tick it. Add the following and run it Sub test() Dim objFSO As Object Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject MsgBox fso.Drives.Count, , "fso New" Set fso = Nothing Set fso = CreateObject("Scripting.FileSystemObject") MsgBox fso.Drives.Count, , "fso CreateObject" Set fso = Nothing Set objFSO = CreateObject("Scripting.FileSystemObject") MsgBox objFSO.Drives.Count, , "objFSO CreateObject" End Sub Report back if all/some/none of the above tests worked, or if you couldn't even set the reference. Regards, Peter T "Budget Programmer" <BudgetProgrammer(a)discussions.microsoft.com> wrote in message news:69212031-A693-4434-ABDC-C2FFA60B492C(a)microsoft.com... > Peter, > Are you speaking of Virus Protection Software or some other system > setting? > I'm not quite sure what you mean. I'm the only one that uses the machine, > but maybe some update or something changed it. Where should I look? > Thanks. > Phil > -- > Programmer on Budget > > > "Peter T" wrote: > >> Maybe Scripting has been disabled by the administrator in that machine >> >> Regards, >> Peter T >> >> "Budget Programmer" <BudgetProgrammer(a)discussions.microsoft.com> wrote in >> message news:64948855-B022-42C2-942A-15FD8E3103BD(a)microsoft.com... >> > Hello, >> > >> > For a year and a half I've had an Excel macro working fine. I haven't >> > changed anything to the PC that would affect Excel, to my knowledge. >> > I'm running Vista 32 Home Premium and Office 2007. >> > I have the following references checked in "Tools / References": >> > - Visual Basic for Applications >> > - Microsoft Excel 12.0 Object Library >> > - OLE Automation >> > - Microsoft Office 12.0 Object Library >> > >> > This code runs on other PC's, but it stopped running on this >> > (essential) >> > one. >> > When it encounters the first SET statement, it give the error: >> > "Run-time error '429': >> > ActiveX component can't create object" >> > >> > Sub CreateEditedSongListing() >> > 'DECLARE VARIABLES >> > Dim objFSO As Object >> > Dim objFolder As Object >> > Dim strSongs_EditedPath As String >> > >> > 'ASSIGN INITIAL VALUES >> > >> > strSongs_EditedPath = "C:\Users\Phil\Documents\Songbook On >> > Screen\Songs-Edited" >> > >> > 'Use Microsoft Scripting runtime. >> > Set objFSO = CreateObject("Scripting.FileSystemObject") >> > Set objFolder = objFSO.GetFolder(strSongs_EditedPath) >> > End Sub >> > >> > In which reference is the "Scripting.FileSystemObject" located? >> > The code snipet runs fine on another PC, which has the same four >> > references >> > checked. However it stopped runing on the essential PC. >> > Thanks for looking into this. >> > Phil >> > -- >> > Programmer on Budget >> >> >> . >>
From: Budget Programmer on 22 Jan 2010 14:17
Hi Peter, Before doing anything, I ran stepped through your code. It stopped at the DIM FSO statement. Initially, I couldn't a reference for "Microsoft Scripting Runtime". I went to another PC and found that the reference is located in file "C:\Windows\System32\scrrun.dll" I browesed for that and was able to add the reference. (It's interesting that I had to browse for it.) However, At the SET statement I get the same error: "Run-time error '429': ActiveX component can't create object" Thanks for your help. I'm still at a loss. Phil -- Programmer on Budget "Peter T" wrote: > If you are the only user then it sounds like it has not been disabled. > (Though it is one component admin's sometimes want to disable in a corporate > environment). > > In Tools References look for "Microsoft Scripting Runtime" and tick it. Add > the following and run it > > Sub test() > Dim objFSO As Object > Dim fso As Scripting.FileSystemObject > > Set fso = New Scripting.FileSystemObject > > MsgBox fso.Drives.Count, , "fso New" > Set fso = Nothing > > Set fso = CreateObject("Scripting.FileSystemObject") > MsgBox fso.Drives.Count, , "fso CreateObject" > > Set fso = Nothing > > Set objFSO = CreateObject("Scripting.FileSystemObject") > MsgBox objFSO.Drives.Count, , "objFSO CreateObject" > > End Sub > > Report back if all/some/none of the above tests worked, or if you couldn't > even set the reference. > > Regards, > Peter T > > > "Budget Programmer" <BudgetProgrammer(a)discussions.microsoft.com> wrote in > message news:69212031-A693-4434-ABDC-C2FFA60B492C(a)microsoft.com... > > Peter, > > Are you speaking of Virus Protection Software or some other system > > setting? > > I'm not quite sure what you mean. I'm the only one that uses the machine, > > but maybe some update or something changed it. Where should I look? > > Thanks. > > Phil > > -- > > Programmer on Budget > > > > > > "Peter T" wrote: > > > >> Maybe Scripting has been disabled by the administrator in that machine > >> > >> Regards, > >> Peter T > >> > >> "Budget Programmer" <BudgetProgrammer(a)discussions.microsoft.com> wrote in > >> message news:64948855-B022-42C2-942A-15FD8E3103BD(a)microsoft.com... > >> > Hello, > >> > > >> > For a year and a half I've had an Excel macro working fine. I haven't > >> > changed anything to the PC that would affect Excel, to my knowledge. > >> > I'm running Vista 32 Home Premium and Office 2007. > >> > I have the following references checked in "Tools / References": > >> > - Visual Basic for Applications > >> > - Microsoft Excel 12.0 Object Library > >> > - OLE Automation > >> > - Microsoft Office 12.0 Object Library > >> > > >> > This code runs on other PC's, but it stopped running on this > >> > (essential) > >> > one. > >> > When it encounters the first SET statement, it give the error: > >> > "Run-time error '429': > >> > ActiveX component can't create object" > >> > > >> > Sub CreateEditedSongListing() > >> > 'DECLARE VARIABLES > >> > Dim objFSO As Object > >> > Dim objFolder As Object > >> > Dim strSongs_EditedPath As String > >> > > >> > 'ASSIGN INITIAL VALUES > >> > > >> > strSongs_EditedPath = "C:\Users\Phil\Documents\Songbook On > >> > Screen\Songs-Edited" > >> > > >> > 'Use Microsoft Scripting runtime. > >> > Set objFSO = CreateObject("Scripting.FileSystemObject") > >> > Set objFolder = objFSO.GetFolder(strSongs_EditedPath) > >> > End Sub > >> > > >> > In which reference is the "Scripting.FileSystemObject" located? > >> > The code snipet runs fine on another PC, which has the same four > >> > references > >> > checked. However it stopped runing on the essential PC. > >> > Thanks for looking into this. > >> > Phil > >> > -- > >> > Programmer on Budget > >> > >> > >> . > >> > > > . > |