Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Programming Excel to open a program

I have an application where I want Excel to open a file listed in a
spreadsheet. This spreadsheet contains a list of Autocad drawings. Ordinarily
I'd just use the Hyperlink function to allow the user to click on it and
AutoCad will open the file. However, we have limited netowrk licenses and
they are assigned on a first come basis. If all of the licenses are in use,
and someone tried to open a drawing with AutoCad it will fail. I'd like to
make it so that when the user clicks on the filename, an Autocad viewer will
open.

I was thinking that a command button with some embedded code would do the
trick. The code would look at the cell and get the filename (which includes
the entire path to the drawing). Then the program would open it with the
drawing viewer.

However, I'm at a loss as to HOW to do this. Any help?

DGreco
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Programming Excel to open a program

Use SHELL. Refer below example

Shell("C:\WINDOWS\NOTEPAD.EXE " & filename, vbNormalFocus)

If this post helps click Yes
---------------
Jacob Skaria


"DGreco" wrote:

I have an application where I want Excel to open a file listed in a
spreadsheet. This spreadsheet contains a list of Autocad drawings. Ordinarily
I'd just use the Hyperlink function to allow the user to click on it and
AutoCad will open the file. However, we have limited netowrk licenses and
they are assigned on a first come basis. If all of the licenses are in use,
and someone tried to open a drawing with AutoCad it will fail. I'd like to
make it so that when the user clicks on the filename, an Autocad viewer will
open.

I was thinking that a command button with some embedded code would do the
trick. The code would look at the cell and get the filename (which includes
the entire path to the drawing). Then the program would open it with the
drawing viewer.

However, I'm at a loss as to HOW to do this. Any help?

DGreco

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Programming Excel to open a program

Create a file c:\1.txt and try tbe below from Immediate window

shell "c:\windows\NOTEPAD.exe" "C:\1.txt"
--
If this post helps click Yes
---------------
Jacob Skaria


"DGreco" wrote:

I have an application where I want Excel to open a file listed in a
spreadsheet. This spreadsheet contains a list of Autocad drawings. Ordinarily
I'd just use the Hyperlink function to allow the user to click on it and
AutoCad will open the file. However, we have limited netowrk licenses and
they are assigned on a first come basis. If all of the licenses are in use,
and someone tried to open a drawing with AutoCad it will fail. I'd like to
make it so that when the user clicks on the filename, an Autocad viewer will
open.

I was thinking that a command button with some embedded code would do the
trick. The code would look at the cell and get the filename (which includes
the entire path to the drawing). Then the program would open it with the
drawing viewer.

However, I'm at a loss as to HOW to do this. Any help?

DGreco

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Programming Excel to open a program

Thanks for the sample code. I understand the concept. The shell command will
open NotePad. But I believe the code in the example is not formatted
correctly to get Notepad to open up the file, "C:\1.txt". I tried it out and
it didn't work. I get this error message:

Compile Error
Syntax Error

This leads me to my next question. I would assume that if the drawing name
is in cell "B2", I can use the following code to save the contents of "B2" to
a variable name.

Set strFname = Range("c2").Value

But if I do this, I get a syntax error because the value of the cell is not
a text string. I would assume that I have to convert it to a string in order
to use in in conjunction with the SHELL command. Correct? if so, how do I
pass the contents of the cell to the shell command in a format is can use?
--
DGreco


"Jacob Skaria" wrote:

Create a file c:\1.txt and try tbe below from Immediate window

shell "c:\windows\NOTEPAD.exe" "C:\1.txt"
--
If this post helps click Yes
---------------
Jacob Skaria


"DGreco" wrote:

I have an application where I want Excel to open a file listed in a
spreadsheet. This spreadsheet contains a list of Autocad drawings. Ordinarily
I'd just use the Hyperlink function to allow the user to click on it and
AutoCad will open the file. However, we have limited netowrk licenses and
they are assigned on a first come basis. If all of the licenses are in use,
and someone tried to open a drawing with AutoCad it will fail. I'd like to
make it so that when the user clicks on the filename, an Autocad viewer will
open.

I was thinking that a command button with some embedded code would do the
trick. The code would look at the cell and get the filename (which includes
the entire path to the drawing). Then the program would open it with the
drawing viewer.

However, I'm at a loss as to HOW to do this. Any help?

DGreco

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Programming Excel to open a program

i want to know wether we can delete the row which has comon items(by using
any function) pls help


"Jacob Skaria" wrote:

Use SHELL. Refer below example

Shell("C:\WINDOWS\NOTEPAD.EXE " & filename, vbNormalFocus)

If this post helps click Yes
---------------
Jacob Skaria


"DGreco" wrote:

I have an application where I want Excel to open a file listed in a
spreadsheet. This spreadsheet contains a list of Autocad drawings. Ordinarily
I'd just use the Hyperlink function to allow the user to click on it and
AutoCad will open the file. However, we have limited netowrk licenses and
they are assigned on a first come basis. If all of the licenses are in use,
and someone tried to open a drawing with AutoCad it will fail. I'd like to
make it so that when the user clicks on the filename, an Autocad viewer will
open.

I was thinking that a command button with some embedded code would do the
trick. The code would look at the cell and get the filename (which includes
the entire path to the drawing). Then the program would open it with the
drawing viewer.

However, I'm at a loss as to HOW to do this. Any help?

DGreco



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Programming Excel to open a program

To insert a double-quote use two double-quotes.

So, assuming your notepad program is in c:\windows and the file of interest
is c:\a b c.txt (I intentionally added spaces to the file name for my test),
use

Shell "c:\windows\notepad.exe ""c:\a b c.txt""", vbNormalFocus

To refer to the file in cell C2, use

Shell "c:\windows\notepad.exe """ & Range("c2").Value & """",
vbNormalFocus
--
Tushar Mehta
http://www.tushar-mehta.com
Custom business solutions leveraging a multi-disciplinary approach
In Excel 2007 double-click to format may not work; right click and select
from the menu


"DGreco" wrote:

Thanks for the sample code. I understand the concept. The shell command will
open NotePad. But I believe the code in the example is not formatted
correctly to get Notepad to open up the file, "C:\1.txt". I tried it out and
it didn't work. I get this error message:

Compile Error
Syntax Error

This leads me to my next question. I would assume that if the drawing name
is in cell "B2", I can use the following code to save the contents of "B2" to
a variable name.

Set strFname = Range("c2").Value

But if I do this, I get a syntax error because the value of the cell is not
a text string. I would assume that I have to convert it to a string in order
to use in in conjunction with the SHELL command. Correct? if so, how do I
pass the contents of the cell to the shell command in a format is can use?
--
DGreco


"Jacob Skaria" wrote:

Create a file c:\1.txt and try tbe below from Immediate window

shell "c:\windows\NOTEPAD.exe" "C:\1.txt"
--
If this post helps click Yes
---------------
Jacob Skaria


"DGreco" wrote:

I have an application where I want Excel to open a file listed in a
spreadsheet. This spreadsheet contains a list of Autocad drawings. Ordinarily
I'd just use the Hyperlink function to allow the user to click on it and
AutoCad will open the file. However, we have limited netowrk licenses and
they are assigned on a first come basis. If all of the licenses are in use,
and someone tried to open a drawing with AutoCad it will fail. I'd like to
make it so that when the user clicks on the filename, an Autocad viewer will
open.

I was thinking that a command button with some embedded code would do the
trick. The code would look at the cell and get the filename (which includes
the entire path to the drawing). Then the program would open it with the
drawing viewer.

However, I'm at a loss as to HOW to do this. Any help?

DGreco

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot open excel files unless from the program itself Pedro Setting up and Configuration of Excel 0 November 14th 07 11:41 AM
I cant open files unless I open the Excel program first ElaineAng Excel Discussion (Misc queries) 3 February 16th 06 02:54 PM
open up an excel program with an auto open macro [email protected] Excel Programming 2 July 17th 05 04:48 PM
I can not open my excel program, myriam Excel Discussion (Misc queries) 1 March 18th 05 01:42 PM
can't open 2 excel program a once tim Excel Worksheet Functions 2 February 22nd 05 02:49 AM


All times are GMT +1. The time now is 06:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"