![]() |
export data to an existing and open workbook without knowing the f
I'm writing a windows forms app in .net. I want to export data to an open and
visible workbook, the filename of which I do not know. Is this possible? If so, how? |
export data to an existing and open workbook without knowing the f
If it is the only open workbook, you can use index like:
Workbooks(1) to refer to it. Otherwise, I am pretty sure you would need to know the file name. You also have the sheet name and number to contend with, but that can be handled by adding a sheet, if necessary. "vernington" wrote: I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? |
export data to an existing and open workbook without knowing the f
In VBA, I'd depend on the activesheet.
dim Actwks as worksheet set actwks = activesheet and then work on the actwks msgbox actwks.name & vblf & actwks.parent.fullname vernington wrote: I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? -- Dave Peterson |
export data to an existing and open workbook without knowing t
I've kind of found what I was looking for:
(Excel.Application)System.Runtime.InteropServices. Marshal.GetActiveObject( "Excel.Application" ); This returns a reference to the last created excel application object. Although I'm still looking for a reference to them all. "Dave Peterson" wrote: In VBA, I'd depend on the activesheet. dim Actwks as worksheet set actwks = activesheet and then work on the actwks msgbox actwks.name & vblf & actwks.parent.fullname vernington wrote: I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? -- Dave Peterson |
export data to an existing and open workbook without knowing the f
If you do not know the filename, how will you know if you find it ?
NickHK "vernington" wrote in message ... I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? |
export data to an existing and open workbook without knowing t
The idea is to open the existing, open workbooks, i.e. those being used by
the user. "NickHK" wrote: If you do not know the filename, how will you know if you find it ? NickHK "vernington" wrote in message ... I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? |
export data to an existing and open workbook without knowing t
In VB, you would use GetObject on an Excel.Application
Then use its ActiveWorkbook/ActiveSheet However, there may be more than one instance of Excel running and you cannot be sure which instance the system will return. There are ways of looping through all instances (PeterT has posted some code for this in this NG), but unless you have some marker to see which is the correct instance, this will not help you. Can you not just create you own instance to work with ? NickHK "vernington" wrote in message ... The idea is to open the existing, open workbooks, i.e. those being used by the user. "NickHK" wrote: If you do not know the filename, how will you know if you find it ? NickHK "vernington" wrote in message ... I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? |
export data to an existing and open workbook without knowing t
yes, that is the problem I have, can you please give me a link to PeterT's
code? "NickHK" wrote: In VB, you would use GetObject on an Excel.Application Then use its ActiveWorkbook/ActiveSheet However, there may be more than one instance of Excel running and you cannot be sure which instance the system will return. There are ways of looping through all instances (PeterT has posted some code for this in this NG), but unless you have some marker to see which is the correct instance, this will not help you. Can you not just create you own instance to work with ? NickHK "vernington" wrote in message ... The idea is to open the existing, open workbooks, i.e. those being used by the user. "NickHK" wrote: If you do not know the filename, how will you know if you find it ? NickHK "vernington" wrote in message ... I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? |
export data to an existing and open workbook without knowing t
Maybe this thread:
http://groups.google.co.uk/group/mic...acf5db3c19b29e But how will that help you, if you do not know which filename/instance you should be addressing ? NickHK "vernington" wrote in message ... yes, that is the problem I have, can you please give me a link to PeterT's code? "NickHK" wrote: In VB, you would use GetObject on an Excel.Application Then use its ActiveWorkbook/ActiveSheet However, there may be more than one instance of Excel running and you cannot be sure which instance the system will return. There are ways of looping through all instances (PeterT has posted some code for this in this NG), but unless you have some marker to see which is the correct instance, this will not help you. Can you not just create you own instance to work with ? NickHK "vernington" wrote in message ... The idea is to open the existing, open workbooks, i.e. those being used by the user. "NickHK" wrote: If you do not know the filename, how will you know if you find it ? NickHK "vernington" wrote in message ... I'm writing a windows forms app in .net. I want to export data to an open and visible workbook, the filename of which I do not know. Is this possible? If so, how? |
All times are GMT +1. The time now is 05:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com