ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Importing file handle name with pasted data (https://www.excelbanter.com/excel-programming/336160-importing-file-handle-name-pasted-data.html)

[email protected]

Importing file handle name with pasted data
 
Hello,

Does anyone know of a function (if this is even possible in Excel),
that imports a file handle (name of the source file) & displays
it in an adjacent cell every time that I cut & paste data from that
file into Excel.

For example, I copy a text string from the text file 'data.txt'
into the clipboard, I bring up the Excel Worksheet, paste the
data into a cell & the cell in the same row, next column over
automatically populates with the path & filename of the origin
('C:\My Documents\data.txt' in this case).

Any help on this is thoroughly appreciated.

Thanks!


K Dales[_2_]

Importing file handle name with pasted data
 
If it is possible it is not easy. If the source application supports OLE via
cut and paste it would be easier, since you could paste the link and then
extract the value from the resulting cell and then extract the linked file
name from the cell formula. But that won't be true for all apps.

If anything you would have to develop your own clipboard routines to handle
this. Can't even say if that is possible, although there is a clipboard
function, GetClipboardOwner, that does in general get the handle to the last
app that copied into the clipboard. But I have never tried anything that
complex and wouldn't want to. In case you do, here is a link to the info
about the Clipboard functions from the Windows API:
http://msdn.microsoft.com/library/de.../clipboard.asp

--
- K Dales


" wrote:

Hello,

Does anyone know of a function (if this is even possible in Excel),
that imports a file handle (name of the source file) & displays
it in an adjacent cell every time that I cut & paste data from that
file into Excel.

For example, I copy a text string from the text file 'data.txt'
into the clipboard, I bring up the Excel Worksheet, paste the
data into a cell & the cell in the same row, next column over
automatically populates with the path & filename of the origin
('C:\My Documents\data.txt' in this case).

Any help on this is thoroughly appreciated.

Thanks!



[email protected]

Importing file handle name with pasted data
 
Thanks a bunch!

I'll check up on the website.

- Michael

K Dales wrote:
If it is possible it is not easy. If the source application supports OLE via
cut and paste it would be easier, since you could paste the link and then
extract the value from the resulting cell and then extract the linked file
name from the cell formula. But that won't be true for all apps.

If anything you would have to develop your own clipboard routines to handle
this. Can't even say if that is possible, although there is a clipboard
function, GetClipboardOwner, that does in general get the handle to the last
app that copied into the clipboard. But I have never tried anything that
complex and wouldn't want to. In case you do, here is a link to the info
about the Clipboard functions from the Windows API:
http://msdn.microsoft.com/library/de.../clipboard.asp

--
- K Dales


" wrote:

Hello,

Does anyone know of a function (if this is even possible in Excel),
that imports a file handle (name of the source file) & displays
it in an adjacent cell every time that I cut & paste data from that
file into Excel.

For example, I copy a text string from the text file 'data.txt'
into the clipboard, I bring up the Excel Worksheet, paste the
data into a cell & the cell in the same row, next column over
automatically populates with the path & filename of the origin
('C:\My Documents\data.txt' in this case).

Any help on this is thoroughly appreciated.

Thanks!





All times are GMT +1. The time now is 07:29 PM.

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