Visual basic code with macros

I want to put a named variable into a Header or footer and be able to format the variable to get larger font.  I can get the variable into the footer through macro code but not add the formatting code.  Is this possible?  Can anyone help?
Thanks.
0
anonymous (74722)
11/14/2003 9:16:13 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
508 Views

Similar Articles

[PageSpeed] 11

I recorded a macro when I did it manually.

This was the bit I kept:

    With ActiveSheet.PageSetup
         .CenterFooter = "&20asdfasdf"
    End With

I could modify that to look like:

    Dim myStr As String
    
    myStr = "This is a test!"
    With ActiveSheet.PageSetup
         .CenterFooter = "&20" & myStr
    End With

And if your variable starts with a number, I'd do:

    Dim myStr As String
    
    myStr = "This is a test!"
    With ActiveSheet.PageSetup
         .CenterFooter = "&20 " & myStr
    End With

(extra space after &20.)

Just to make sure that excel sees the size as 20 and not a size concatenated
with your string.


dmt wrote:
> 
> I want to put a named variable into a Header or footer and be able to format the variable to get larger font.  I can get the variable into the footer through macro code but not add the formatting code.  Is this possible?  Can anyone help?
> Thanks.

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
11/15/2003 2:24:02 AM
Reply:

Similar Artilces:

scanning bar codes in pos
Is it possible to scan a bar code without having to press the enter key to make a transaction? It seems counter-productive to do it this way Frank, You should be able to program your scanner to add an 'ENTER' as a suffix to the scan. That is the way we do it. Marc "Frank" <nary@ec.rr.com> wrote in message news:1153175013.344333.97120@b28g2000cwb.googlegroups.com... > Is it possible to scan a bar code without having to press the enter key > to make a transaction? It seems counter-productive to do it this way > Some scanners require programming to s...

Internationalization for formulas & macros
Hi all, I have a relative who send me some Excel spreadsheet (97, 2000 or XP that contains formulas and macros written in english. However, I have a french version of Excel. Because of this, I can' open these spreadsheets. My question is quite simple. Is there a tool or an easy way to convert all formulas & macros withi a spreadsheet from english to french? Any help will be appreciated. Thank' -- micto ----------------------------------------------------------------------- mictou's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1637 View this th...

pasting of variable cell value into macro
I have written a macro that runs an autofilter which grabs cell info from a different worksheet within that workbook (an entered date). It then uses that date to autofilter. It works fine the first time, but aparently plugs that info permanently into the macro and will not work on subsequent runs. I need a macro that will grab variable info from a certain cell each time and run with that new cell value each time. Any ideas?. (& yes, I am a newbee) sorry.. Your problem is refreshing the autofilter. It is best to clear the old filter before applying the new filter. Here ...

Help correcting HTTP redirect code for OWA Exchange 2K3
Hi, I am using the code from Q article 55126 to redirect incomming http request to https for OWA. I keep getting the error below. Can someone help me with the solution to this. Thanks in advance --mdanny ****** Microsoft VBScript compilation error '800a0401' Expected end of statement /owa_redirect/owahttps.asp, line 1 If Request.ServerVariables("SERVER_PORT")=80 Then Dim strSecureURL strSecureURL = "https://" strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME") strSecureURL = strSecureUR...

able to record & run macro but not edit !
All Excel97 . When I open a file with an existing macro (or create a new spreadshee and simply record an entry in a cell ) and go to Tools/Macro/Macros th macro list is visible and I can run the macro but if I try to edit it get a Microsoft Visual Basic pop-up 'Unexpected error ; quitting' o if I simply try to open the VBE i get a similar pop-up with ' Out o Memory'. Same files work fine at work (Excel 97) where I edited macros n problem. I've tried uninstalling/reinstalling Excel from the office 97 dis along with data access & Office tools (and their elements) ti...

Getting Excel to return Hiragana using code/char functions
I have a Japanese computer which does this perfectly, but when I tried to use the worksheet on an English computer with Japanese language enabled, it only came up with errors. The code it was returning for the Japanese characters was much to low & putting in higher codes meant it didn`t recognise it. What can I do to make it work? ...

Basic Question
Hi all, I have a table called Companytbl with 2 fields: CompanyID (autonumber), CompanyName(text) On the form ( which related to a different table)I have company combobox. What exactly is the setup so on the combobox it will show the companyName and it will store in the table theCompanyID? TIA, Tom In news:%23Z%23x%23Q9JIHA.5928@TK2MSFTNGP05.phx.gbl, Tom <partner1973@yahoo.com> wrote: > Hi all, > > I have a table called Companytbl with 2 fields: CompanyID > (autonumber), CompanyName(text) > > On the form ( which related to a different table)I have company &...

Parse XML into Collection
I'm a newbie so please bear with me... I'm looking to parse XML into a Collection so that I can pass that collection around to functions to extract data from it easily. I'm hoping there is code already to parse std XML files into a Collection? All I've found is code where the XML structure is already known... I need to code to work no matter what the structure... it would "figure out" what nodes are parents/children and such then place them into a Collection appropriately. Any help is appreciated! An XmlDocument already defines a hierarchy of collections when it p...

Visual basic for application project in database is corrupt
I'm running Office 2003 on Windows XP. I have a database that does not open, and gives me a message stating that Microsoft Access has detected corruption in this file. The message goes on to suggest that I run Compact and Repair Database from the Tools menu. When I do, I get the error message above. Is there any way of recovering this database? Thank you for your response. I actually tried both ways, linking and inporting, but I'm unable to gain access to the corrupted database. The only thing I have been able to do is access it through MSQuery in Excel, but that only gets me to ...

Macro
Thanks to those who offered help but I still am not quite there with the correct solution. R.Venkataraman's code was almost correct but I don't think I explained myself correctly. In my sheet1 the user inputs numbers (1-50) in column A.(pluss loads of other data in columns B:P) what I require is the macro to ask the user to input the 'job' they want to print. So if the user inputs <9> then column A in sheet 1 is searched for the number 9 then the contents of that particular row are copied (without formula - just cell values) and the data pasted onto row A2 of sheet...

Activation Code for Money 2004 Deluxe
Can anyone get this link to work with either button. I keep getting the page can not be displayed. http://shop.microsoft.com/MoneyUpgrade/PurchaseQuestion.as p?SKU=860- 00211&SKUName=Mohttp://shop.microsoft.com/MoneyUpgrade/Pur chaseQuestion.asp?SKU=860-00211&SKUName=Money%20Deluxe% 202003%20English%20Upgrade%20From%20Money% 20Trial&img=/OMLibrary/images/X0880521frs.jpg Jason, Just use the link without the SKU: http://shop.microsoft.com/MoneyUpgrade/PurchaseQuestion.asp Good Luck! Regards, JB "jasona@arnell-west.com" <anonymous@discussions.microsoft.com>...

VBA codes question
Hi, I just write down some VBA codes for an application. What I need is extract some data from a selected area by mouse left-button. So what should I do ? The most I concerned is how to get the Range object of the shadow area selected by mouse. Thanks. ...

About Macros #2
Hi ! Even though I have deleted all macros from my workbook, I still get the pop-up saying that macros are disabled. How do I get rid of this annoying feature? Thanks for all help, David Debra Dalgleish has a great explanation with pictures on how to deal with this issue. http://www.contextures.com/xlfaqMac.html#NoMacros HTH Paul -------------------------------------------------------------------------------------------------------------- Be advised to back up your WorkBook before attempting to make changes. ------------------------------------------------------------------------------...

Hide worksheets if macros are disable
Hi, what I was hoping to do is if the marcros are disable when the file is opened all the worksheets are hidden except one with a message saying to enable macros in which case this sheet would be hidden if the macros were enable. TIA If macros are disabled, there's nothing you can do to change they way it opens. Maybe you can save the file with the worksheets hidden the way you want. Then have your auto_open/workbook_open unhide the ones you want to see. Eintsein_mc2 wrote: > > Hi, what I was hoping to do is if the marcros are disable when the file > is opened all the work...

Excel should allow macro on a shared workbook.
We are using excel tables all the time at my company. There are more than 20 people working on the same excel file which has thousands of columns so we use autofilter or some other macros. Shared workbook will help us alot because we will be able to change the file at the same time which is very time saving. Is there any way that macros are allowed at shared workbooks? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not ...

error code 0x80040154 my question is this, why doesn't MS take th
error code 0x80040154 my question is this, why doesn't MS take this error seriously? I came here for the first time because of this error. I was able to work around it ONLY because we had also purchased Office Pro. 2000 and can access the Clip Art from that disk. If anyone doesn't have this opportunity they are not going to be able to access their Clip Art in 2003 because of this error. I have come back and for two years individuals are still asking for help, a fix and a repair. NOTHING suggested ever helps or repairs this error and we have tried them all. I have the option of ...

Filtering data within macros
I have a spread sheet with 6 coloums of data such as name,month,job. have filters so i can see how many jobs are done in a month or how man jobs one person is doing. I would like to be able to write a macr which works out most of the combinations of filters and outputs it t a seperate sheet. There are lots of different options for each coloum tho! Is there any quick ways i can do this other than reseting th filters everytime for every combination? hope i have explained this ok....its even confusing me!! Cheers Robert -- Message posted from http://www.ExcelForum.com This may be helpful ...

macro to delete multiple rows
I have recorded, then modified, the following macro, which unprotects the sheet, aks if you are sure you want to delete the row, deletes the current row, copies down a cell in column A that numbers the row, and protects the sheet. Works fine, but if the user wants to delete not only the current row, but multiple rows below it also, the macro must be repeated. How can I accomplish deleting multiple rows, as indicated by the user? For example, rows 18 thru 20, or 29 thru 33, etc, or of course, just the current row, with the message box prompting the user for the number of rows to delete. Thanks...

Macro-Save as
I need to know how to 'default' the save file type as an .xls from a .dat within a macro. After a macro has completed changing many .dat files into excel spreadsheets to include subtotals, the file type is defaulted to .dat and when I go to save the file, I have to constantly change the file type from .dat to .xls. "Lois" wrote: > I need to know how to 'default' the save file type as an .xls from a .dat > within a macro. After a macro has completed changing many .dat files into > excel spreadsheets to include subtotals, the file type is defaulted to...

How void receipt/shipment with wrong Item account codes
Series : Purchase Order Processing http://img341.imageshack.us/img341/135/20100312185625.png No sure by create a Purchase Return can help =96 my concern is wrong account codes & the standard cost. Under Item maintenance, the item (V0910) has already with wrong account codes and wrong standard cost, Has been wrong even BEFOFE the creation of the receipt shipment. So, the Shipment transaction is now with the wrong accounts. I am wondering if by doing a purchase return (Transaction > Purchasing > Return Transaction Entry) can help to reversing all the wrong entries f...

Using a macro question.
Can you execute a macro from inside a formula? IF(A1="Y",execute.macro,"") Thanks Adam, not with a formula, but you can use a worksheet change event like this, put in sheet code Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target.Address = "$A$1" And UCase(Target.Value) = "Y" Then 'put your code here End If End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Usin...

Code completion not working in VC++ 6.0
Hi, Anyone seen this before? Code completion is not working properly in visual C++ 6.0. When I type . or ->, I no longer see the member list after it. Once I type in a function and ( then it will show me the parameters. But not the member list. I checked and I do have all the code completion options selected. What gives? Not sure when this stopped working, I haven't used it in quite some time (probably a couple years!) but now am using it again and this is driving me nuts. Am thinking maybe I should reinstall but would like to avoid that (especially since who knows if it will e...

How do I run a macro when a value occurs in a cell
I want to run a macro when a value appears in a cell. How can this be accomplished? Hi! This is a trivial example but you can build on it: Private Sub Worksheet_Change(ByVal Target As Range) If Range("D3") = 36 Then Range("D3").Interior.ColorIndex = 6 Else Range("D3").Interior.ColorIndex = 2 End If End Sub Put =A3*3 in D3 Try values such as 12, 10 in A3 Al -- Alf ----------------------------------------------------------------------- AlfD's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=478 View this thread: http://www.excelforu...

Saving without VBA code
I have a workbook that has some VBA code in the ThisWorkbook module to define a toolbar button. This button uses VBA code in another module to save a set of ranges to a new spreadsheet file. I accomplish this by creating a new workbook, copying each range (each is on a separate worksheet), then saving the new workbook with a new name. Unfortunately, the VBA code in ThisWorkbook is also copied to the new workbook, so when the new spreadsheet file is opened, it also has the toolbar button. Is there any way to do this without also copying the VBA code from ThisWorkbook? Or, is there a way to remo...

Hyperlink to open .dot with a macro
I have a word .dot that has a simple macro when opened, but when I try to open the .dot from a hyperlink the macro doesn't autostart. Any ideas? I opened word and created a new test2.dot template file. I put this code under the ThisDocument module: Option Explicit Private Sub Document_New() MsgBox "hi from new" End Sub Private Sub Document_Open() MsgBox "hi from open" End Sub I put a hyperlink in a cell in an excel worksheet that pointed to that test2.dot file. The Document_Open() event fired--but the actual template (test2.dot) opened--a new document bas...