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.
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.
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.