Error 1004 Vb Script
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Error 1004 Excel
policies of this site About Us Learn more about Stack Overflow the error 1004 vba company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Runtime Error 1004 Method Range Of Object _global Failed Visual Basic
Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes vba runtime error 1004 method range of object _worksheet failed a minute: Sign up Visual Basic runtime error 1004 up vote -1 down vote favorite I am trying to write a Visual Basic Script to run by windows task scheduler. The script is supposed to open a delimited text file into excel and then save it as an .xlsx file. Function ImportText() Path = "C:\Users\username\Documents\" inFile = "2014_1_31_data_parse.txt" outFile = "2014_1_31_data_parse.xlsx" Set runtime error 1004 excel 2013 objExcel = CreateObject("Excel.Application") objExcel.Workbooks.OpenText FileName:=Path & inFile, Other:=True, OtherChar:="^" objExcel.ActiveWorkbook.SaveAs FileName:=Path & outFile objExcel.Quit WScript.Quit WScript.Echo "Completed" End Function Currently it gives a Run-time error of 1004 file can not be found. However the file is there. excel vba excel-vba vbscript share|improve this question asked Jan 31 '14 at 20:34 Infernobass7 3414 2 Are you sure you are doing this via VBScript? i.e a text file saved as a .vbs file? –Siddharth Rout Jan 31 '14 at 20:41 3 If your path is really "C:\Users\username\Documents\" it's not going to find a file. Unles you actually have a user named "username". –tbur Jan 31 '14 at 20:42 1 There are couple of issues with your code besides the path problem i.e if you are actually using a .VBS file. See THIS link. It will help you create your code. –Siddharth Rout Jan 31 '14 at 21:02 I personally can't get this to compile, with it failing on the line objExcel.Workbooks.OpenTest.... I don't know that VBScript will actually allow you to pass a string the way you are attemptin
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us
Visual Basic Runtime Error '1004' Select Method Of Range Class Failed
Learn more about Stack Overflow the company Business Learn more about hiring developers run time error 1004 excel 2007 or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow
Run Time Error 1004 Paste Method Of Worksheet Class Failed
Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Run time error 1004, Application defined or object http://stackoverflow.com/questions/21489566/visual-basic-runtime-error-1004 defined error up vote 0 down vote favorite I have written vbscript code to add chart in page 1 of excel for which the source is from other sheet of same excel which name is "CL.1.1" but i am getting the above error can any one help what was wrong in my below code. Sub DispvsTime(Shname) Sheets("Sheet1").Select noofsheets = ActiveSheet.ChartObjects.Count If noofsheets > 0 Then ActiveSheet.ChartObjects.Select ActiveSheet.ChartObjects.Delete http://stackoverflow.com/questions/16477852/run-time-error-1004-application-defined-or-object-defined-error End If Sheets("Sheet1").Pictures.Visible = False ActiveSheet.Shapes.AddChart(1000, 420, 50, 500).Select ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ActiveChart.SetSourceData Source:=Sheets("Shname").Range("G2:H2001") ActiveChart.SetElement (msoElementChartTitleAboveChart) ActiveChart.ChartTitle.Text = "Displacement VS Time" End Sub here "shname" is name of the sheet where data is picked. vbscript share|improve this question edited May 10 '13 at 9:32 mortb 2,2682622 asked May 10 '13 at 8:17 surendra 2729 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote Shouldn't the line ActiveChart.SetSourceData Source:=Sheets("Shname").Range("G2:H2001") be ActiveChart.SetSourceData Source:=Sheets(Shname).Range("G2:H2001") since you want to use the variable Shname and not just a sheet named "Shname" Hope this helps! share|improve this answer answered May 10 '13 at 9:32 mortb 2,2682622 actually i used shname only when i debug the code it is giving the proper name oft he sheet. shname variable is replaced with actual value but still i am facing the issue –surendra May 10 '13 at 10:01 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms
Forums Excel Questions VB: run-time error '1004': Application-defined or object-defined error Results 1 http://www.mrexcel.com/forum/excel-questions/569679-vbulletin-run-time-error-1004-application-defined-object-defined-error.html to 10 of 10 VB: run-time error '1004': Application-defined or object-defined errorThis is a discussion on VB: run-time error '1004': Application-defined or object-defined error within the Excel Questions forums, part of the Question Forums category; Hi, I just started using VB to create macros in Excel recently and I error 1004 could really use some help. This ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Aug 5th, 2011,02:05 PM #1 ABS New time error 1004 Member Join Date Aug 2011 Posts 2 VB: run-time error '1004': Application-defined or object-defined error Hi, I just started using VB to create macros in Excel recently and I could really use some help. This macro is intended to go through a column of identifiers in one worksheet (OrgNameMatches) and for each cell search if there is a matching identifier in another column in another worksheet (OrgFacilityRelationship) of the same file. If there is a match, then a hyperlink is to be created between the identifier from OrgNameMatches to the identifier in OrgFacilityRelationship. I have the following code so far… (The Run-time error '1004': Application-defined or object-defined error occurs after the following lines: Sheets("OrgFacilityRelationship").Select Range("A2").Select lines Code: Sub orgFacilityLink() Sheets("OrgNameMatches").Activate Sheets("OrgNameMatches").Select Range("A2").Select Do Until Selection.Offset(1, 0).Value = "" varIdMatch = False varIdValue = ActiveCell.Value varIdRow = ActiveCell.Row Sheets("OrgFacilityRelationship").Act