![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi I get a 'Object not supported error xl_app.Workbooks.Worksheets" when I add this line in the program: "If xl_app.Workbooks.Worksheets("Results").Range("A2:A 2") is Null then" The sample code I am running is Function Main() 'References to Excel dim xl_app dim xl_Spreadsheet SET xl_app = CREATEOBJECT("Excel.Application") 'SET xl_app = GetObject("\\archive\Daily\Report.xls") SET xl_spreadsheet = xl_app.Workbooks.Open("\\archive\Daily\Report.xls" ) 'Run the macro If xl_app.Workbooks.Worksheets("Results").Range("A2:A 2") is Null then xl_app.Run("transform_macro") End If xl_spreadsheet.Save xl_spreadsheet.Close xl_app.Quit set xl_app = Nothing etc.... ------- What is the correct syntax to reference a Cell value and check if it is Null? I have tried various combinations to no avail. Thanks. |
#3
| |||
| |||
|
|
Hello javathehutt, Hi I get a 'Object not supported error xl_app.Workbooks.Worksheets" when I add this line in the program: "If xl_app.Workbooks.Worksheets("Results").Range("A2:A 2") is Null then" The sample code I am running is Function Main() 'References to Excel dim xl_app dim xl_Spreadsheet SET xl_app = CREATEOBJECT("Excel.Application") 'SET xl_app = GetObject("\\archive\Daily\Report.xls") SET xl_spreadsheet = xl_app.Workbooks.Open("\\archive\Daily\Report.xls" ) 'Run the macro If xl_app.Workbooks.Worksheets("Results").Range("A2:A 2") is Null then xl_app.Run("transform_macro") End If xl_spreadsheet.Save xl_spreadsheet.Close xl_app.Quit set xl_app = Nothing etc.... ------- What is the correct syntax to reference a Cell value and check if it is Null? I have tried various combinations to no avail. Thanks. Function Main() 'References to Excel dim xl_app dim xl_Spreadsheet dim wkb dim wks Set xl_app = CreateObject("Excel.Application") Set xl_spreadsheet = xl_app.Workbooks.Open("\\archive\Daily\Report.xls" ) xl_app.DisplayAlerts = False 'Run the macro If IsEmpty ( xl_app.Workbooks(1).Worksheets("Results").Range("A 2").value ) then xl_app.Run("transform_macro") End If xl_spreadsheet.Save xl_spreadsheet.Close xl_app.DisplayAlerts = True xl_app.Quit set xl_app = Nothing Main = DTSTaskExecResult_Success End function Bye |
![]() |
| Thread Tools | |
| Display Modes | |
| |