Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
For you JIM, 19/09/05
Hi, I'm tryng to accomplish something difficult to explain:
If you open a workbook (ex. hello.xls) and the you go to file--open another file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same excel window, but if you open hello.xls ant then you go to the excels general icon (the one that opens an excel window with a new woorkbook on it) ant then you choose file--open hello2.xls then you have 2 excel windows, now my problem: I have my firs book hello.xls with all the menu bars disabled but the woorkbook hello2.xls needs all the menu bars enabled so if I open my workbook as explained on the second way to open the file I can have my file hello.xls without the menu bars and hello2.xls with all the menu bars enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I cant paste a shortcut in the desktop because when I open the second file, it opens in the excels window of my first file. It's very important that the user of my program could open the file from the desktop, so there is a way to do what I want????? Hope this have sence, TIA |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
For you JIM, 19/09/05
You can give this code a try... Place it in a module in a new workbook.
Change the path and file name to the file you want to open in a new instance of Excel. Private Const m_strPath As String = "C:\" Private Const m_strFileName As String = "TestTemplate.xls" Sub Auto_Open() Dim appXL As Excel.Application Dim wbk As Workbook Set appXL = CreateObject("Excel.Application.9") appXL.Visible = True Set wbk = appXL.Workbooks.Open(m_strPath & m_strFileName, , True) wbk.RunAutoMacros xlAutoOpen ThisWorkbook.Close SaveChanges:=False End Sub It essentially forms a shortcut to an excel file. The end user never really gets to see this workbook. The only point to it is to create new instance of Excel immediately prior to opening the Excel file you want in a new instance. The warning here is that the two instances of Excel are completely seperate. Code in one instance can not reference the other instance (not easily anyway). -- HTH... Jim Thomlinson "filo666" wrote: Hi, I'm tryng to accomplish something difficult to explain: If you open a workbook (ex. hello.xls) and the you go to file--open another file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same excel window, but if you open hello.xls ant then you go to the excels general icon (the one that opens an excel window with a new woorkbook on it) ant then you choose file--open hello2.xls then you have 2 excel windows, now my problem: I have my firs book hello.xls with all the menu bars disabled but the woorkbook hello2.xls needs all the menu bars enabled so if I open my workbook as explained on the second way to open the file I can have my file hello.xls without the menu bars and hello2.xls with all the menu bars enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I cant paste a shortcut in the desktop because when I open the second file, it opens in the excels window of my first file. It's very important that the user of my program could open the file from the desktop, so there is a way to do what I want????? Hope this have sence, TIA |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
For you JIM, 19/09/05
thanks, I'll give it a try, ¿do you want another of my unsolved questions???
1.Hi, I have a macro that finds the last row used and the insert a new row at bottom of the last one and in cell a put the name of a person (userform1 askes it),in cell b the status and in cell c the amount; what I want is that in cell d appears a button so the user could print the information of the user in the row, I ahev everithing but how to possitioning the button exactly in cell D How to acomplish this??? TIa 2.Exist something like private range("a1")_change end sub I know it could be used in the worksheet_change method but if I want all my sheets do the same thing in the same range???? TIA "Jim Thomlinson" wrote: You can give this code a try... Place it in a module in a new workbook. Change the path and file name to the file you want to open in a new instance of Excel. Private Const m_strPath As String = "C:\" Private Const m_strFileName As String = "TestTemplate.xls" Sub Auto_Open() Dim appXL As Excel.Application Dim wbk As Workbook Set appXL = CreateObject("Excel.Application.9") appXL.Visible = True Set wbk = appXL.Workbooks.Open(m_strPath & m_strFileName, , True) wbk.RunAutoMacros xlAutoOpen ThisWorkbook.Close SaveChanges:=False End Sub It essentially forms a shortcut to an excel file. The end user never really gets to see this workbook. The only point to it is to create new instance of Excel immediately prior to opening the Excel file you want in a new instance. The warning here is that the two instances of Excel are completely seperate. Code in one instance can not reference the other instance (not easily anyway). -- HTH... Jim Thomlinson "filo666" wrote: Hi, I'm tryng to accomplish something difficult to explain: If you open a workbook (ex. hello.xls) and the you go to file--open another file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same excel window, but if you open hello.xls ant then you go to the excels general icon (the one that opens an excel window with a new woorkbook on it) ant then you choose file--open hello2.xls then you have 2 excel windows, now my problem: I have my firs book hello.xls with all the menu bars disabled but the woorkbook hello2.xls needs all the menu bars enabled so if I open my workbook as explained on the second way to open the file I can have my file hello.xls without the menu bars and hello2.xls with all the menu bars enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I cant paste a shortcut in the desktop because when I open the second file, it opens in the excels window of my first file. It's very important that the user of my program could open the file from the desktop, so there is a way to do what I want????? Hope this have sence, TIA |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
For you JIM, 19/09/05
Sub AddButton()
Dim btn As OLEObject Dim wks As Worksheet Dim rng As Range Set wks = ActiveSheet Set rng = ActiveCell Set btn = wks.OLEObjects.Add(ClassType:="Forms.CommandButton .1") With btn .Object.Caption = "Tada" .Name = "cmdMyButton" .Top = rng.Top .Left = rng.Left End With End Sub This is a control button not a forms button... -- HTH... Jim Thomlinson "filo666" wrote: thanks, I'll give it a try, ¿do you want another of my unsolved questions??? 1.Hi, I have a macro that finds the last row used and the insert a new row at bottom of the last one and in cell a put the name of a person (userform1 askes it),in cell b the status and in cell c the amount; what I want is that in cell d appears a button so the user could print the information of the user in the row, I ahev everithing but how to possitioning the button exactly in cell D How to acomplish this??? TIa 2.Exist something like private range("a1")_change end sub I know it could be used in the worksheet_change method but if I want all my sheets do the same thing in the same range???? TIA "Jim Thomlinson" wrote: You can give this code a try... Place it in a module in a new workbook. Change the path and file name to the file you want to open in a new instance of Excel. Private Const m_strPath As String = "C:\" Private Const m_strFileName As String = "TestTemplate.xls" Sub Auto_Open() Dim appXL As Excel.Application Dim wbk As Workbook Set appXL = CreateObject("Excel.Application.9") appXL.Visible = True Set wbk = appXL.Workbooks.Open(m_strPath & m_strFileName, , True) wbk.RunAutoMacros xlAutoOpen ThisWorkbook.Close SaveChanges:=False End Sub It essentially forms a shortcut to an excel file. The end user never really gets to see this workbook. The only point to it is to create new instance of Excel immediately prior to opening the Excel file you want in a new instance. The warning here is that the two instances of Excel are completely seperate. Code in one instance can not reference the other instance (not easily anyway). -- HTH... Jim Thomlinson "filo666" wrote: Hi, I'm tryng to accomplish something difficult to explain: If you open a workbook (ex. hello.xls) and the you go to file--open another file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same excel window, but if you open hello.xls ant then you go to the excels general icon (the one that opens an excel window with a new woorkbook on it) ant then you choose file--open hello2.xls then you have 2 excel windows, now my problem: I have my firs book hello.xls with all the menu bars disabled but the woorkbook hello2.xls needs all the menu bars enabled so if I open my workbook as explained on the second way to open the file I can have my file hello.xls without the menu bars and hello2.xls with all the menu bars enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I cant paste a shortcut in the desktop because when I open the second file, it opens in the excels window of my first file. It's very important that the user of my program could open the file from the desktop, so there is a way to do what I want????? Hope this have sence, TIA |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
For you JIM, 19/09/05
Thankyou very much jim
"Jim Thomlinson" wrote: Sub AddButton() Dim btn As OLEObject Dim wks As Worksheet Dim rng As Range Set wks = ActiveSheet Set rng = ActiveCell Set btn = wks.OLEObjects.Add(ClassType:="Forms.CommandButton .1") With btn .Object.Caption = "Tada" .Name = "cmdMyButton" .Top = rng.Top .Left = rng.Left End With End Sub This is a control button not a forms button... -- HTH... Jim Thomlinson "filo666" wrote: thanks, I'll give it a try, ¿do you want another of my unsolved questions??? 1.Hi, I have a macro that finds the last row used and the insert a new row at bottom of the last one and in cell a put the name of a person (userform1 askes it),in cell b the status and in cell c the amount; what I want is that in cell d appears a button so the user could print the information of the user in the row, I ahev everithing but how to possitioning the button exactly in cell D How to acomplish this??? TIa 2.Exist something like private range("a1")_change end sub I know it could be used in the worksheet_change method but if I want all my sheets do the same thing in the same range???? TIA "Jim Thomlinson" wrote: You can give this code a try... Place it in a module in a new workbook. Change the path and file name to the file you want to open in a new instance of Excel. Private Const m_strPath As String = "C:\" Private Const m_strFileName As String = "TestTemplate.xls" Sub Auto_Open() Dim appXL As Excel.Application Dim wbk As Workbook Set appXL = CreateObject("Excel.Application.9") appXL.Visible = True Set wbk = appXL.Workbooks.Open(m_strPath & m_strFileName, , True) wbk.RunAutoMacros xlAutoOpen ThisWorkbook.Close SaveChanges:=False End Sub It essentially forms a shortcut to an excel file. The end user never really gets to see this workbook. The only point to it is to create new instance of Excel immediately prior to opening the Excel file you want in a new instance. The warning here is that the two instances of Excel are completely seperate. Code in one instance can not reference the other instance (not easily anyway). -- HTH... Jim Thomlinson "filo666" wrote: Hi, I'm tryng to accomplish something difficult to explain: If you open a workbook (ex. hello.xls) and the you go to file--open another file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same excel window, but if you open hello.xls ant then you go to the excels general icon (the one that opens an excel window with a new woorkbook on it) ant then you choose file--open hello2.xls then you have 2 excel windows, now my problem: I have my firs book hello.xls with all the menu bars disabled but the woorkbook hello2.xls needs all the menu bars enabled so if I open my workbook as explained on the second way to open the file I can have my file hello.xls without the menu bars and hello2.xls with all the menu bars enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I cant paste a shortcut in the desktop because when I open the second file, it opens in the excels window of my first file. It's very important that the user of my program could open the file from the desktop, so there is a way to do what I want????? Hope this have sence, TIA |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|