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
352 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
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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