From: Helmut Meukel on 26 Apr 2010 08:20 Hi all, my VB6 program creates every morning an Excel workbook with 1 sheet. The actual product and weight for 57 storage tanks is written into this sheet. During the day, if the product changes, a new line is added to the sheet. The next morning the final amount for each tank is written into a column, the workbook closed and a new workbook created for this day. That works great, but now the customer wants the title row and first column fixed (non-scrollable) by my program when it creates the sheet. I know he could easily do this manually, but... I searched but couldn't find how to do this by code. Probably I didn't ask the right questions - english isn't my first language :-( Helmut.
From: MikeD on 26 Apr 2010 08:56 "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message news:eZxgerT5KHA.620(a)TK2MSFTNGP02.phx.gbl... > That works great, but now the customer wants the title row and first column fixed (non-scrollable) by my program when it creates > the sheet. > I know he could easily do this manually, but... > I searched but couldn't find how to do this by code. Probably I didn't > ask the right questions - english isn't my first language :-( > An Excel VBA newsgroup is probably your best bet for getting an answer because those people will be much more familar with the Excel object library than most people here and what you're asking has everything to do with Excel's object library and little to do with VB6. -- Mike
From: Norm Cook on 26 Apr 2010 09:04 "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message news:eZxgerT5KHA.620(a)TK2MSFTNGP02.phx.gbl... > Hi all, > > my VB6 program creates every morning an Excel workbook with 1 sheet. > The actual product and weight for 57 storage tanks is written into this > sheet. > During the day, if the product changes, a new line is added to the sheet. > The next morning the final amount for each tank is written into a column, > the workbook closed and a new workbook created for this day. > > That works great, but now the customer wants the title row and first > column fixed (non-scrollable) by my program when it creates the sheet. > I know he could easily do this manually, but... > I searched but couldn't find how to do this by code. Probably I didn't > ask the right questions - english isn't my first language :-( > > Helmut. Perhaps you've seen this before, but one way to see how Excel does something is to start a Macro recording, do what you want and look at the generated code. After looking at Excel's help, it looks like you freeze a column by selecting the column to its right, then Window|Freeze Panes. Here's the code for freezing B Sub FreezeB() Columns("B:B").Select ActiveWindow.FreezePanes = True End Sub
From: Helmut Meukel on 26 Apr 2010 09:40 Norm, I haven't done any makro recording since the days of Windows 3.1 so I totally forgot that Excel is capable of makro recording. I now came up with ws.Range("B2").Select ActiveWindow.FreezePanes = True Thanks Helmut. "Norm Cook" <normcook(a)cableone.net> schrieb im Newsbeitrag news:%23$DfyDU5KHA.1932(a)TK2MSFTNGP05.phx.gbl... > "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message > news:eZxgerT5KHA.620(a)TK2MSFTNGP02.phx.gbl... >> Hi all, >> >> my VB6 program creates every morning an Excel workbook with 1 sheet. >> The actual product and weight for 57 storage tanks is written into this >> sheet. >> During the day, if the product changes, a new line is added to the sheet. >> The next morning the final amount for each tank is written into a column, >> the workbook closed and a new workbook created for this day. >> >> That works great, but now the customer wants the title row and first column >> fixed (non-scrollable) by my program when it creates the sheet. >> I know he could easily do this manually, but... >> I searched but couldn't find how to do this by code. Probably I didn't >> ask the right questions - english isn't my first language :-( >> >> Helmut. > > Perhaps you've seen this before, but one way to see how Excel > does something is to start a Macro recording, do what you > want and look at the generated code. After looking at > Excel's help, it looks like you freeze a column by selecting > the column to its right, then Window|Freeze Panes. Here's > the code for freezing B > > Sub FreezeB() > Columns("B:B").Select > ActiveWindow.FreezePanes = True > End Sub > >
From: Nobody on 26 Apr 2010 10:30 "Helmut Meukel" <NoSpam(a)NoProvider.de> wrote in message news:e2fX%23XU5KHA.4740(a)TK2MSFTNGP06.phx.gbl... > Norm, > > I haven't done any makro recording since the days of Windows 3.1 > so I totally forgot that Excel is capable of makro recording. > I now came up with > ws.Range("B2").Select > ActiveWindow.FreezePanes = True That code is why you need to ask in an Excel group. There is no need to "Select" first, which interferes with what the user has currently selected.
|
Next
|
Last
Pages: 1 2 3 4 Prev: Scrollbar Repeats Next: How to send email with no outlook and SMTP server ? |