Have Excel Open Query File (1 Viewer)

LadyDi

Registered User.
Local time
Today, 00:39
Joined
Mar 29, 2007
Messages
894
I have an Excel spreadsheet that is being used to create a query file for a program called DataQuant (which I can open using this command: Call Shell("C:\Program Files\Rocket Software\Rocket Shuttle\Rocket Shuttle for Workstation\eclipse.exe", 1)). I am using the below code to create the Query file that I want to run.

Code:
Sub WriteQueryCelltoFile()
Dim Filelocation As String
Dim Queryname As String

Dim ws As Worksheet

Dim rownum As Long
Dim colnum As Long

Filelocation = "C:\Temp\"
Queryname = "BSPQuery.qry"

rownum = 10
colnum = 2

Set ws = Worksheets("Prepare")
With ws
    Open (Filelocation & Queryname) For Output As #1
        Print #1, ws.Cells(rownum, colnum);
    Close #1

End With
Open (Filelocation & Queryname) For Output As #2

End Sub

I would like to set the Spreadsheet to automatically open the file once it is created, but am not having any success. I tried adding the line that reads "Open (Filelocation & Queryname) For Output As #2", but that didn't open the file in DataQuant. I tried using the msoFileDialogOpen command, but that didn't work either. That command showed the dialog box to select the file, but when I clicked the Open button, nothing happened. Is there a way to get this file to open in DataQuant once it is created? Any assistance you can provide would be greatly appreciated.
 

RayH

Registered User.
Local time
Today, 00:39
Joined
Jun 24, 2003
Messages
132
I recognize that code ;)

Instead of the Output#2 line why doesn't the Call Shell cmd that you have work?
Will DataQuant take a parameter?

Call Shell("C:\Program Files\Rocket Software\Rocket Shuttle\Rocket Shuttle for Workstation\eclipse.exe " & Filelocation & Queryname, 1)).
 

Users who are viewing this thread

Top Bottom