Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Concatinating strings in a footer

I am having a problem with the delopment of some code to construct a footer.
By creating a macro I got the following:

ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftFooter = "&""Times New Roman,Regular""&8Path String&F"
End With

I am trying to construct a footer string on the fly, concatenating the font
formatting ("&""Times New Roman,Regular""&8), the Path String and the auto
file name (&F")

I tried several things including assigning the entire string to a variable
causing Excel to ignore the control (&) characters as well as assigning the
string components to several variables causing Excel's VBA engine to cough up
a hairball. Any ideas?
--
Sierk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Concatinating strings in a footer

Sub formatt()
Dim s As String
dq = Chr(34)
pound = "&"
s = pound & dq & "Times" & dq & "Hello World"
ActiveSheet.PageSetup.CenterHeader = s
End Sub

As you can see, the only tricky point is getting the double quote (dq) in
the proper place in the string.
--
Gary''s Student - gsnu200827


"Sierk" wrote:

I am having a problem with the delopment of some code to construct a footer.
By creating a macro I got the following:

ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftFooter = "&""Times New Roman,Regular""&8Path String&F"
End With

I am trying to construct a footer string on the fly, concatenating the font
formatting ("&""Times New Roman,Regular""&8), the Path String and the auto
file name (&F")

I tried several things including assigning the entire string to a variable
causing Excel to ignore the control (&) characters as well as assigning the
string components to several variables causing Excel's VBA engine to cough up
a hairball. Any ideas?
--
Sierk

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Concatinating strings in a footer

Thanks. It makes sense now. The confusion came from me not understanding
the function of the control characters:
So
.LeftFooter = pound & dq & "Times" & dq & "Hello World" would actually
translate into:
.LeftFooter = "&""Times""Hello World"

This puts "Hello World" (without quotes) in your footer using the Times font




--
Sierk


"Gary''s Student" wrote:

Sub formatt()
Dim s As String
dq = Chr(34)
pound = "&"
s = pound & dq & "Times" & dq & "Hello World"
ActiveSheet.PageSetup.CenterHeader = s
End Sub

As you can see, the only tricky point is getting the double quote (dq) in
the proper place in the string.
--
Gary''s Student - gsnu200827


"Sierk" wrote:

I am having a problem with the delopment of some code to construct a footer.
By creating a macro I got the following:

ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftFooter = "&""Times New Roman,Regular""&8Path String&F"
End With

I am trying to construct a footer string on the fly, concatenating the font
formatting ("&""Times New Roman,Regular""&8), the Path String and the auto
file name (&F")

I tried several things including assigning the entire string to a variable
causing Excel to ignore the control (&) characters as well as assigning the
string components to several variables causing Excel's VBA engine to cough up
a hairball. Any ideas?
--
Sierk

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Concatinating strings in a footer

The confusion is not your problem alone.

I can never remember whether to type a single double-quote, two
double-quotes, or three double-quotes.

That why I usually use the variable dq
--
Gary''s Student - gsnu200827


"Sierk" wrote:

Thanks. It makes sense now. The confusion came from me not understanding
the function of the control characters:
So
.LeftFooter = pound & dq & "Times" & dq & "Hello World" would actually
translate into:
.LeftFooter = "&""Times""Hello World"

This puts "Hello World" (without quotes) in your footer using the Times font




--
Sierk


"Gary''s Student" wrote:

Sub formatt()
Dim s As String
dq = Chr(34)
pound = "&"
s = pound & dq & "Times" & dq & "Hello World"
ActiveSheet.PageSetup.CenterHeader = s
End Sub

As you can see, the only tricky point is getting the double quote (dq) in
the proper place in the string.
--
Gary''s Student - gsnu200827


"Sierk" wrote:

I am having a problem with the delopment of some code to construct a footer.
By creating a macro I got the following:

ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftFooter = "&""Times New Roman,Regular""&8Path String&F"
End With

I am trying to construct a footer string on the fly, concatenating the font
formatting ("&""Times New Roman,Regular""&8), the Path String and the auto
file name (&F")

I tried several things including assigning the entire string to a variable
causing Excel to ignore the control (&) characters as well as assigning the
string components to several variables causing Excel's VBA engine to cough up
a hairball. Any ideas?
--
Sierk

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
creating, concatinating, cell addresses Mal[_2_] Excel Programming 1 April 8th 08 09:17 PM
Concatinating text plus cell containing date Lori Excel Worksheet Functions 2 October 17th 07 08:06 PM
Concatinating a string of numbers - how? drod Excel Discussion (Misc queries) 5 August 2nd 06 10:02 PM
Programming header/footer strings with line feed XP Excel Programming 5 August 26th 05 01:12 PM
Concatinating cells Praveen Excel Programming 4 August 11th 05 09:14 AM


All times are GMT +1. The time now is 12:42 PM.

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

About Us

"It's about Microsoft Excel"