I'm trying to open worksheet by taking value from one cell and concate the desire file name but it shows error : object variable or with block variable not set i'm using following code : where "123.xlsx" is name of workbook that i want to open .
Dim output_path As Workbook
dim xlwkbrpt1 as workbook
output_path = Application.ActiveWorkbook.ActiveSheet.Range("F14").Value
Set xlwkbrpt1 = xlApp.Workbooks.Open(output_path & "\" & "123.xlsx")
You declared variable output_path
with wrong type. Try this:
Dim output_path As String
Dim xlwkbrpt1 As Workbook
output_path = Application.ActiveWorkbook.ActiveSheet.Range("F14").Value
Set xlwkbrpt1 = Workbooks.Open(output_path & "\" & "123.xls")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.