Solved

How do I open an Excel 2000 sheet in VB6 that is connected to access through a datasource?

Posted on 2004-08-19
5
353 Views
Last Modified: 2010-05-02
How do I open an Excel 2000 sheet in VB6 that is connected to access through a datasource without the datasource residing on that particular computer?I need to have this sheet open refresh all datasources and then print to several printers?  I can't get it to work unless I create datasources on each computer.  
0
Comment
Question by:sjmmajor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:jmacmicking
ID: 11843157
Use a file datasource instead of a system or user datasource.  That way you can store the file for the datasource in a common location (a network drive for instance) and set the Excel sheet to reference it there.
0
 

Author Comment

by:sjmmajor
ID: 11845425
Does the worksheet have to reside on each computer?  I have tried to connect a worksheet on a network drive but it doesn't update when I run it unless I detach and attach the link again.  Any better ways of doing this?
0
 

Author Comment

by:sjmmajor
ID: 11845496
Also, sometimes I am getting a binding error.
0
 
LVL 5

Accepted Solution

by:
jmacmicking earned 125 total points
ID: 11852651
The worksheet should be able to reside on a network drive with no trouble.  If you're not %100 sure everyone will have the same drive mapped to the same drive letter make sure you use the UNC path (\\servername\sharename\path).
If you can include the binding error it may help.  A few other tips;  change the Refresh control to disable background refresh (that way you don't get stall data while the refresh is occuring) and to refresh the data on file open.  To do this in Excel 2000 follow these steps:
  Open the workbook in Excel.
  Select one of the cells in the data range
  Open the Data menu
  Highlight Import External Data
  Click Data Range Properties (if this is greyed out make sure you've selected a cell in the data range)
  Turn off Enable background refresh
  Turn on Refresh data on file open
 
If you need help using the Excel object model to open and print the database let me know; I can post pseudo-code to get you started.
0
 

Author Comment

by:sjmmajor
ID: 11897466
Thanks.  I changed the datasources to file datasources on the server and used the UNC path as well as refresh the data.  It works!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question