ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   paste file name of an OFFice program into a cell (https://www.excelbanter.com/excel-programming/411386-paste-file-name-office-program-into-cell.html)

Henry

paste file name of an OFFice program into a cell
 
I would like an Excel user to be able to go to a cell, and then paste the
file name ,(preferably without the full path, but that is not an absolute
need,) into the cell. The file will be in the same folder, and will be a
Word, Visio or Powerpoint file.
The purpose is an Excel 2003 sales CRM program, where sales types can add
the name of the contract or "sales pitch" to this cell on a shared network.
Then management will be able to click on the cell and review the sales
document
I am not a sophisticated user, with no working knowledge of VB or macros.
but I can follow directions

joel

paste file name of an OFFice program into a cell
 
code will open a Pop-Up window and allow you to select a file then put in a
hyperlink to the file you select.

Sub AddLink()

CurrentDir = ThisWorkbook.Path
CurrentDir = "c:\temp"
FName = Application _
.GetOpenFilename( _
"Text Files (*.txt), *.txt," & _
"Power Point Files (*.ppt), *.ppt," & _
"Visio Files (*.vsd), *.vsd," & _
"All Files (*.*), *.*")

Set fs = CreateObject("Scripting.FileSystemObject")
FBaseName = fs.GetBaseName(FName)


ActiveCell.Hyperlinks.Add _
Anchor:=Selection, _
Address:=FName, _
TextToDisplay:=FBaseName

End Sub


"Henry" wrote:

I would like an Excel user to be able to go to a cell, and then paste the
file name ,(preferably without the full path, but that is not an absolute
need,) into the cell. The file will be in the same folder, and will be a
Word, Visio or Powerpoint file.
The purpose is an Excel 2003 sales CRM program, where sales types can add
the name of the contract or "sales pitch" to this cell on a shared network.
Then management will be able to click on the cell and review the sales
document
I am not a sophisticated user, with no working knowledge of VB or macros.
but I can follow directions



All times are GMT +1. The time now is 10:25 PM.

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