Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default I need an Excel Genius !!!!!!!!!!!!!!! Headers/Footer Changes

I think I need some work around code. I have two workbooks named QG and
Add-In. Add-In contains all the code to manipulate data in QG. I have two
option buttons in Sheets("QUOTE") in QG. Each option button represents a
company. When an option button is clicked the code below located in Add-In
is called, which changes the Header and Footer to represent that company.
The code works fine, but there is a fault. If the Logo is moved to a
different folder the code fails.

Is there a way to store the two company logos (.jpeg) in one of the
workbooks so that when one of the option buttons are clicked the appropriate
company logo will be displayed in the left header?

Sub HeaderFooterChanger()

Dim strLogoFileName As String
Dim strRightHeader As String
Dim strCenterFooter As String

Application.ScreenUpdating = False

With Sheets("QUOTE")

' which option button is true
' Constants Enumeration: xlOn = 1 and xlOff = -4146
Select Case xlOn

' Ad Tech
Case .OptionButtons("optAdTech").Value

strLogoFileName = "\\cdc.gov\private\M131\iqz9\Ad
Tech\Temporary\Ad Tech Logo.jpg"

strRightHeader = "&""-,Bold""QUOTATION / SALES AGREEMENT" &
Chr(10) & _
"&""-,Regular""Ad-Tech International, Inc."
& Chr(10) & _
"2963 Pleasant Hill Road" & Chr(10) & _
"Duluth, GA 30096" & Chr(10) & _
"PH 770-209-9102, Fax 770-209-0465" &
Chr(10) & _
"&D"
strCenterFooter = "Ad-Tech International, Inc." & Chr(10) & _
"www.adtechintl.com"

' Formetco
Case .OptionButtons("optFormetco").Value

strLogoFileName = "\\cdc.gov\private\M131\iqz9\Ad
Tech\Temporary\Formetco Logo.jpg"

strRightHeader = "&""-,Bold""QUOTATION / SALES AGREEMENT" &
Chr(10) & _
"&""-,Regular""Formetco" & Chr(10) & _
"2963 Pleasant Hill Road" & Chr(10) & _
"Duluth, GA 30096" & Chr(10) & _
"PH 1-800-Formetco, Fax ???-???-????" &
Chr(10) & _
"&D"
strCenterFooter = "Formetco" & Chr(10) & _
"www.formetco.com"
End Select

' change header/footer properties
With .PageSetup

' remove old header
.LeftHeader = ""

' change logo
.LeftHeaderPicture.Filename = strLogoFileName

' ensure header picture can be visible
.LeftHeader = "&G"

' change header/footer
.RightHeader = strRightHeader
.CenterFooter = strCenterFooter
End With
End With

Application.ScreenUpdating = True

End Sub
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default I need an Excel Genius !!!!!!!!!!!!!!! Headers/Footer Changes

This is a suggestion you may not want...

Why not just make sure that the pictures are in the same folder as the addin.

Then you could use:
strLogoFileName = thisworkbook.path & "\" & "Ad Tech Logo.jpg"

======

I didn't do much looking, but it looks (from recording a macro) that the picture
in the header/footer has to come from an external file. (This may be completely
wrong, though. I'll await more responses!)

There are ways of saving a range/chart as a picture.

Harald Staff's routine at David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/xl2gif.htm


Ryan H wrote:

I think I need some work around code. I have two workbooks named QG and
Add-In. Add-In contains all the code to manipulate data in QG. I have two
option buttons in Sheets("QUOTE") in QG. Each option button represents a
company. When an option button is clicked the code below located in Add-In
is called, which changes the Header and Footer to represent that company.
The code works fine, but there is a fault. If the Logo is moved to a
different folder the code fails.

Is there a way to store the two company logos (.jpeg) in one of the
workbooks so that when one of the option buttons are clicked the appropriate
company logo will be displayed in the left header?

Sub HeaderFooterChanger()

Dim strLogoFileName As String
Dim strRightHeader As String
Dim strCenterFooter As String

Application.ScreenUpdating = False

With Sheets("QUOTE")

' which option button is true
' Constants Enumeration: xlOn = 1 and xlOff = -4146
Select Case xlOn

' Ad Tech
Case .OptionButtons("optAdTech").Value

strLogoFileName = "\\cdc.gov\private\M131\iqz9\Ad
Tech\Temporary\Ad Tech Logo.jpg"

strRightHeader = "&""-,Bold""QUOTATION / SALES AGREEMENT" &
Chr(10) & _
"&""-,Regular""Ad-Tech International, Inc."
& Chr(10) & _
"2963 Pleasant Hill Road" & Chr(10) & _
"Duluth, GA 30096" & Chr(10) & _
"PH 770-209-9102, Fax 770-209-0465" &
Chr(10) & _
"&D"
strCenterFooter = "Ad-Tech International, Inc." & Chr(10) & _
"www.adtechintl.com"

' Formetco
Case .OptionButtons("optFormetco").Value

strLogoFileName = "\\cdc.gov\private\M131\iqz9\Ad
Tech\Temporary\Formetco Logo.jpg"

strRightHeader = "&""-,Bold""QUOTATION / SALES AGREEMENT" &
Chr(10) & _
"&""-,Regular""Formetco" & Chr(10) & _
"2963 Pleasant Hill Road" & Chr(10) & _
"Duluth, GA 30096" & Chr(10) & _
"PH 1-800-Formetco, Fax ???-???-????" &
Chr(10) & _
"&D"
strCenterFooter = "Formetco" & Chr(10) & _
"www.formetco.com"
End Select

' change header/footer properties
With .PageSetup

' remove old header
.LeftHeader = ""

' change logo
.LeftHeaderPicture.Filename = strLogoFileName

' ensure header picture can be visible
.LeftHeader = "&G"

' change header/footer
.RightHeader = strRightHeader
.CenterFooter = strCenterFooter
End With
End With

Application.ScreenUpdating = True

End Sub
--
Cheers,
Ryan


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default I need an Excel Genius !!!!!!!!!!!!!!! Headers/Footer Changes

That's what I figured I'd have to do, but I wasn't sure if there was another
way. Thanks for the reply!
--
Cheers,
Ryan


"Dave Peterson" wrote:

This is a suggestion you may not want...

Why not just make sure that the pictures are in the same folder as the addin.

Then you could use:
strLogoFileName = thisworkbook.path & "\" & "Ad Tech Logo.jpg"

======

I didn't do much looking, but it looks (from recording a macro) that the picture
in the header/footer has to come from an external file. (This may be completely
wrong, though. I'll await more responses!)

There are ways of saving a range/chart as a picture.

Harald Staff's routine at David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/xl2gif.htm


Ryan H wrote:

I think I need some work around code. I have two workbooks named QG and
Add-In. Add-In contains all the code to manipulate data in QG. I have two
option buttons in Sheets("QUOTE") in QG. Each option button represents a
company. When an option button is clicked the code below located in Add-In
is called, which changes the Header and Footer to represent that company.
The code works fine, but there is a fault. If the Logo is moved to a
different folder the code fails.

Is there a way to store the two company logos (.jpeg) in one of the
workbooks so that when one of the option buttons are clicked the appropriate
company logo will be displayed in the left header?

Sub HeaderFooterChanger()

Dim strLogoFileName As String
Dim strRightHeader As String
Dim strCenterFooter As String

Application.ScreenUpdating = False

With Sheets("QUOTE")

' which option button is true
' Constants Enumeration: xlOn = 1 and xlOff = -4146
Select Case xlOn

' Ad Tech
Case .OptionButtons("optAdTech").Value

strLogoFileName = "\\cdc.gov\private\M131\iqz9\Ad
Tech\Temporary\Ad Tech Logo.jpg"

strRightHeader = "&""-,Bold""QUOTATION / SALES AGREEMENT" &
Chr(10) & _
"&""-,Regular""Ad-Tech International, Inc."
& Chr(10) & _
"2963 Pleasant Hill Road" & Chr(10) & _
"Duluth, GA 30096" & Chr(10) & _
"PH 770-209-9102, Fax 770-209-0465" &
Chr(10) & _
"&D"
strCenterFooter = "Ad-Tech International, Inc." & Chr(10) & _
"www.adtechintl.com"

' Formetco
Case .OptionButtons("optFormetco").Value

strLogoFileName = "\\cdc.gov\private\M131\iqz9\Ad
Tech\Temporary\Formetco Logo.jpg"

strRightHeader = "&""-,Bold""QUOTATION / SALES AGREEMENT" &
Chr(10) & _
"&""-,Regular""Formetco" & Chr(10) & _
"2963 Pleasant Hill Road" & Chr(10) & _
"Duluth, GA 30096" & Chr(10) & _
"PH 1-800-Formetco, Fax ???-???-????" &
Chr(10) & _
"&D"
strCenterFooter = "Formetco" & Chr(10) & _
"www.formetco.com"
End Select

' change header/footer properties
With .PageSetup

' remove old header
.LeftHeader = ""

' change logo
.LeftHeaderPicture.Filename = strLogoFileName

' ensure header picture can be visible
.LeftHeader = "&G"

' change header/footer
.RightHeader = strRightHeader
.CenterFooter = strCenterFooter
End With
End With

Application.ScreenUpdating = True

End Sub
--
Cheers,
Ryan


--

Dave Peterson
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Headers and Footer to an Entire Workbook?? Spyder Excel Discussion (Misc queries) 5 February 25th 10 03:46 PM
saving a sheet as a web page and retaining the headers and footer. Susan Excel Discussion (Misc queries) 1 October 27th 06 04:29 PM
Headers and Footer on the Chart do not work?????? maperalia Charts and Charting in Excel 1 March 20th 06 05:01 PM
How do I make the custom headers and footer repeat on every works. Chrisod Excel Worksheet Functions 3 January 24th 05 09:05 AM
spesific fonts for headers&footer is Excel J_J Excel Programming 3 October 16th 04 08:05 AM


All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"