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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Excel File From VB In TurboCad

Status
Not open for further replies.

Kevsim

Instructor
Apr 18, 2000
385
AU
I am running a VB application from within TurboCad, where I need to open a specific Excel spreadsheet.
With the code below this happens OK.
However, With the same code I cannot open the Excel file I require.
The code runs to the end without error.
Excel has launched and has a window with nothing in it, not even a blank spreadsheet.
What am I doing wrong to prevent the Excel spreadsheet from loading.
I would appreciate your advise.

Sub Openfile()
Activate = Shell("C:\Program Files\Microsoft Office\Office\excel.exe", 1) ' Run Microsoft Excel.
ChDir _
"C:\Documents and Settings\Personal\My Documents\Mech\Turbo Cad test"
Workbooks.Open Filename:= _
"C:\Documents and Settings\Personal\My Documents\Mech\Turbo Cad test\Testing 1.xls"
Worksheets("Sheet1").Activate
Range("A1").Select
End Sub

kevsim
 


Hi,

In the VB Editor, Tools/References -- Microsoft Excel n.m Object Library.

Then use the GetObject method to open a workbook. Check VB Help.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top