ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open file with VBA (https://www.excelbanter.com/excel-programming/379170-open-file-vba.html)

Otto Moehrbach

Open file with VBA
 
Excel XP & Win XP
I know how to open an Excel Workbook file.
What I want to do is open a non-Excel file when I know the full file name:
"C:\ThePath\FileName.xxx"
Thanks for your time. Otto



ankur

Open file with VBA
 

Hi Otto,

Try..

Sub test()

Workbooks.Open Filename:="C:\ThePath\FileName.xxx"

End Sub

Regards
Ankur
www.xlmacros.com


Otto Moehrbach wrote:

Excel XP & Win XP
I know how to open an Excel Workbook file.
What I want to do is open a non-Excel file when I know the full file name:
"C:\ThePath\FileName.xxx"
Thanks for your time. Otto



Otto Moehrbach

Open file with VBA
 
Ankur
Thanks for responding. That doesn't work. The error message says that
the requested file is not an Excel-compatible file. The file I want to open
is:
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
I tried your method also with the following: (Outlook Express)
"C:\Program Files\Outlook Express\msimn.exe"
Thanks again. Otto
"ankur" wrote in message
ups.com...

Hi Otto,

Try..

Sub test()

Workbooks.Open Filename:="C:\ThePath\FileName.xxx"

End Sub

Regards
Ankur
www.xlmacros.com


Otto Moehrbach wrote:

Excel XP & Win XP
I know how to open an Excel Workbook file.
What I want to do is open a non-Excel file when I know the full file
name:
"C:\ThePath\FileName.xxx"
Thanks for your time. Otto





Kweenie

Open file with VBA
 
You can achieve that by creating a hyperlink.
Right-click in a cell.
Choose Hyperlink and navigate to the desired program.

Regards


Piet


Otto Moehrbach schreef:

Ankur
Thanks for responding. That doesn't work. The error message says that
the requested file is not an Excel-compatible file. The file I want to open
is:
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
I tried your method also with the following: (Outlook Express)
"C:\Program Files\Outlook Express\msimn.exe"
Thanks again. Otto
"ankur" wrote in message
ups.com...

Hi Otto,

Try..

Sub test()

Workbooks.Open Filename:="C:\ThePath\FileName.xxx"

End Sub

Regards
Ankur
www.xlmacros.com


Otto Moehrbach wrote:

Excel XP & Win XP
I know how to open an Excel Workbook file.
What I want to do is open a non-Excel file when I know the full file
name:
"C:\ThePath\FileName.xxx"
Thanks for your time. Otto




Otto Moehrbach

Open file with VBA
 
Martin
Thanks for the help. The macro:
Option Explicit
Sub TryOE()
Dim s As String
s = "C:\Program Files\Outlook Express\msimn.exe"
RetVal = Shell(s, 1)
End Sub
returned an error "variable not defined" and highlighted RetVal. Apparently
RetVal is not recognized.
Your help is greatly appreciated. Otto
"Martin Fishlock" wrote in message
...
Are you trying to execute this program?

If so then try the shell command:

s="C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
RetVal = Shell(s, 1)
--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Otto Moehrbach" wrote:

Ankur
Thanks for responding. That doesn't work. The error message says
that
the requested file is not an Excel-compatible file. The file I want to
open
is:
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
I tried your method also with the following: (Outlook Express)
"C:\Program Files\Outlook Express\msimn.exe"
Thanks again. Otto
"ankur" wrote in message
ups.com...

Hi Otto,

Try..

Sub test()

Workbooks.Open Filename:="C:\ThePath\FileName.xxx"

End Sub

Regards
Ankur
www.xlmacros.com


Otto Moehrbach wrote:

Excel XP & Win XP
I know how to open an Excel Workbook file.
What I want to do is open a non-Excel file when I know the full file
name:
"C:\ThePath\FileName.xxx"
Thanks for your time. Otto







Otto Moehrbach

Open file with VBA
 
Kweenie
Thanks, but this is all part of a VBA procedure to email an Excel sheet.
I'm following Ron de Bruin's email code and I'm assuming that the pertinent
email program has to be open and running before the email code runs. Otto

"Kweenie" wrote in message
oups.com...
You can achieve that by creating a hyperlink.
Right-click in a cell.
Choose Hyperlink and navigate to the desired program.

Regards


Piet


Otto Moehrbach schreef:

Ankur
Thanks for responding. That doesn't work. The error message says
that
the requested file is not an Excel-compatible file. The file I want to
open
is:
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
I tried your method also with the following: (Outlook Express)
"C:\Program Files\Outlook Express\msimn.exe"
Thanks again. Otto
"ankur" wrote in message
ups.com...

Hi Otto,

Try..

Sub test()

Workbooks.Open Filename:="C:\ThePath\FileName.xxx"

End Sub

Regards
Ankur
www.xlmacros.com


Otto Moehrbach wrote:

Excel XP & Win XP
I know how to open an Excel Workbook file.
What I want to do is open a non-Excel file when I know the full file
name:
"C:\ThePath\FileName.xxx"
Thanks for your time. Otto





Otto Moehrbach

Open file with VBA
 
Thanks Martin. Otto
"Martin Fishlock" wrote in message
...
Otto,

Option explicit just requires that you delcare all variables and so that
you
need to dim retval or just remove it if you don't want to use the return.

Option Explicit
Sub TryOE()
Do, RetVal as variant
Dim s As String
s = "C:\Program Files\Outlook Express\msimn.exe"
RetVal = Shell(s, 1)
End Sub

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Otto Moehrbach" wrote:

Martin
Thanks for the help. The macro:
Option Explicit
Sub TryOE()
Dim s As String
s = "C:\Program Files\Outlook Express\msimn.exe"
RetVal = Shell(s, 1)
End Sub
returned an error "variable not defined" and highlighted RetVal.
Apparently
RetVal is not recognized.
Your help is greatly appreciated. Otto
"Martin Fishlock" wrote in message
...
Are you trying to execute this program?

If so then try the shell command:

s="C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
RetVal = Shell(s, 1)
--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Otto Moehrbach" wrote:

Ankur
Thanks for responding. That doesn't work. The error message says
that
the requested file is not an Excel-compatible file. The file I want
to
open
is:
"C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
I tried your method also with the following: (Outlook Express)
"C:\Program Files\Outlook Express\msimn.exe"
Thanks again. Otto
"ankur" wrote in message
ups.com...

Hi Otto,

Try..

Sub test()

Workbooks.Open Filename:="C:\ThePath\FileName.xxx"

End Sub

Regards
Ankur
www.xlmacros.com


Otto Moehrbach wrote:

Excel XP & Win XP
I know how to open an Excel Workbook file.
What I want to do is open a non-Excel file when I know the full
file
name:
"C:\ThePath\FileName.xxx"
Thanks for your time. Otto











All times are GMT +1. The time now is 03:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com