Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cannot open excel files unless from the program itself | Setting up and Configuration of Excel | |||
I cant open files unless I open the Excel program first | Excel Discussion (Misc queries) | |||
open up an excel program with an auto open macro | Excel Programming | |||
I can not open my excel program, | Excel Discussion (Misc queries) | |||
can't open 2 excel program a once | Excel Worksheet Functions |