I'm using VB6 and Excel
I've got an Excel spreadsheet already created and I want to send information to certain cells.
Does anyone have an example on how to do this.
------------------
Thanks in advance for any help provided.
Printable View
I'm using VB6 and Excel
I've got an Excel spreadsheet already created and I want to send information to certain cells.
Does anyone have an example on how to do this.
------------------
Thanks in advance for any help provided.
I'm stuck on this to cannot find anything on the web....is it possible??
It is possible. I had the same problem, the help files in VB and Excel didn't help until I looked at both and cross-referenced them and guessed a bit. I'm in the middle of something but when I get a chance I will see if I can my code doing it.
Basically, you need to make an Excel object, use it to open the file and then just do things with the properties etc. It may take me a bit, gotta finish some stuff first.
Quick example doing it in Access's VBA, opening a Word Document.
Dim WordDoc As Object
Set WordDoc = CreateObject("word.application")
WordDoc.Application.Visible = True
WordDoc.Application.Documents.Open strFileName
WordDoc.Application.windowstate = 1
Basically it's the same but using and Excel object and OpenObject or similar. Hope this gets you started in the right direction. Let me know if you need more or if this helped enough.
[email protected]
[This message has been edited by netSurfer (edited 01-13-2000).]
Thanks people, I've found the answer, so if you want I'll post it for you. Or you can email me and I'll send it
------------------
Thanks in advance for any help provided.
Sure, could you post it.
Right here is the basic information:
Private tmpWorkbook As Excel.Workbook
Private tmpWorkSheet As Excel.Worksheet
Private Sub cmdExport_Click()
Dim fname As String
fname = "c:\my documents\test.xls"
Set tmpWorkbook = GetObject(fname)
tmpWorkbook.Sheets("Sheet 1").Select
Set tmpWorkSheet = tmpWorkbook.ActiveSheet
With tmpWorkSheet
.Cells(7,3)="Testing"
End With
End Sub
Hope this helps.
------------------
Thanks in advance for any help provided.