Resolved Question: set up / help with program for microsoft visual basic 6.0 vba properly to work with excel document?
Please Read Carefully
I have microsoft visual basic 6.0
I am trying to make a simple program.......well it will be complex once i know how to actually make it work with excel spread sheets...............but simply, if i can figure out this then i can do the rest
What basically i want to do is 2 things
1
in the program i have a text box and a command button
When i press the command button i want it to open a pre made excel file and paste the contents of the text box into a cell.............for this question it does not matter the cell, that will be later in the more complex part of the program, however, i just need to know how to do this with a generic cell
Now i think i know the code but the problem is i need to set up visual basic - going to project and add class module...........i know there are actually a few steps and thats what i need
I need to get a step by step procedure to set this up
Here is what i have for code in the command button
Private Sub Command1_Click()
Set exl = New Excel.application
Set wbk = exl.Workbook.Open("C:\Users\Krystal\Desktop\radtest.xlsx")
Set wsht = wbk.Worksheet("overall")
wsht.Range("A4") = txt_1.Text
exl.application.Quit
wsht = Nothing
wbk = Nothing
exl = Nothing
win_Close
Unload Me
End Sub
Now when i run the program to test it i get this error message
compile error:
user-defined type not defined
Now appearently i have to dim my variables so what do i do for that?
As well as from reading the internet it says i have to go to project and add class/module
And i know theres other things to set up
So what are all the steps to set up?????????
2
If i get question 1 answered then question 2 is how do i do the reverse of this
How can i open the spread sheet and get the contents of a cell and put it into a label screen or text box on my program?
Now haveing said that i need the code only
Because question 1 is answering the set up part with the project add class/module and what i do for that
So if someone can alswer part 1 and it orks
then i only want the code info for question 2
thanks
