Hi im just a new here and Im hoping that you can help me. Im having a problem in my project and I cant find any solution in the internet thats why i am hopeful that in this forum somebody will help me.
this is my codes

Private Sub cmdupdate_Click()
Set oapp = Excel.Application
Set oWB = oapp.Workbooks.Add
Set excelWS = Excel.Worksheets("Sheet1")
NewRow = range("A").End(xlDown).Offset(1, 0).Row
oapp.Sheets("Sheet4").Cells(NewRow, 1).Value = txtclient.Text
oWB.SaveAs ("C:\140410.xlsx") ' <-- method or data member not found.

and it highlighted the word .saveas
should i declare it or what?
advance thank you guys.

anyone please......... ??????

Let me give additional information about my project. I have a project that needs to insert data in my existing excel file using textbox. but with the codes that I posted above, I cant continue in my project because of that. so please help. I need to finish this. please any help will be highly appreciated

If you debug, does oWB have a value?

yes, bcause its already an existing excel file.

thank you for the reply

Hi guys. I made it, I manage to input data in my existing excel file. but there is still one problem. I dont know how to determine the empty row where my next data will be inserted. I need help guys. I am hopeful to any suggestion. thanks in advance.

ice

This is my code in inserting data in my excel file but the problem is everytime i will execute this Im having an error but still the data is inserted to my excel.

 wrkSheet.range("B45").Select
    Selection = txtclient.Text ' having an error here run time error 91: object variable or with block variable not set
    wrkSheet.range("B46").Select
    Selection = txtbooknum.Text
     wrkSheet.range("B47").Select
    Selection = txtimp.Text
     wrkSheet.range("B48").Select
    Selection = txtauthor.Text
     wrkSheet.range("B49").Select
    Selection = txtpen.Text

What is Selection ? Doesn't that need to be wrkSheet.Selection ?

hi pritaeas, thanks for your reply. I try to change wrkSheet.range to wrkSheet.Selection but I got an error: method or data member not found.

Where does Selection come from?

ah honestly I just got that code in a thread. so I really dont have any Idea.

I don't know either. Where exactly did you get that code from?

Incomplete.

Does wrkSheet.range("B46").Select return anything?

yes its still returning anything but after that it will show the error.

hey good day! all I just want to know and to learn is how will I put the data in the excel cells without declaring were will it go. I mean the program needs to know or trace the next empty row. is that possible. how will i use range to do it? hope you understand my explanation. thanks alot..

hi guys I made it to insert data inmy excel file and also the range. but I problem because when I clickthe command button to insert data in myexcel file the data will fall to the last empty cell of the sheet. so how will I make it to the first empty cell of the sheet. this is the code that im using.

xlCellTypeLastCell

please guys...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.