Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB 6.0 to connect to Excel

Status
Not open for further replies.

ddelk

Programmer
May 28, 2003
47
US
I have data in an Excel spreadsheet. I want to use VB 6.0 to connect to it, then pull data into text boxes or list boxes or whatever. I have created a 'front end' by using VBA in another Sheet in the Workbook, but it is too limiting. Additionally, I need to package it all together so that I can give it to a user. I have figured out how to connect, but if the Excel file gets moved the connection is lost. I cannot use Access as the data is the result of a statistical model and is driven directly into Excel. I simply want to be able to replace the Excel file and continue using the VB front end.
1. Can VB read UNC path names?
2. Is it possible to make the spreadsheet a part of a VB project or would that require recompiling the code each time the spreadsheet changed?
3. Does VB have an "installer" which would load the .exe file and the Excel file into a specified directory?

Thanks in advance.
 
Sorry, I think I have the wrong forum.
 
I am in the same position. I am looking at active x controlls or reference-ing the excel. It would be great if you find the answer to this one. I have seen this done in a book but it uses word as the example. The code that I have does not work so I wont post it. If I do find some I will post it.
 
oh here it is in the word format per SbendBuckeye ( I thought south bend was in Indiana {housers}) anyway I think he knows his coding.

Here is his post -within this form.
SBendBuckeye (Programmer) Jan 1, 2004
You need to add a reference to Word. While in the VB editor, click on Tools, References and then scroll down until you see Microsoft Word x.x Object Library. Click the checkbox to select it and you're good to go.

Another way to do the same thing if you will be distributing your code to users with different versions is to dim it as object like below:

Dim wdObj As Object
Set wdObj = CreateObject("Word.Application")

Good Luck!
Have a great day!

j2consulting@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top