Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel save AND concatenation problem

can someone help me with this?


Public lpfilename As String

Sub Macro1()

lpfilename = Range("f7")
ActiveWorkbook.SaveAs Filename:="C:\Documents and
Settings\Administrator\My Documents\" & lpfilename,
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub


I believe i need to put quotes on each side of lpfilename...I would
like also in general to know how to do somehting similar to """ (quote
inside quotes) for future reference....By the way F7 is a date
stamp..Thanks much again guys youve all been excellent!


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel save AND concatenation problem

No, you don't need to put quotes on each side of lpfilename unless you want
a file literally named

lpfilename.xls

if it is a date stamp then use

Sub Macro1()

lpfilename = Range("f7").Text
ActiveWorkbook.SaveAs Filename:="C:\Documents and
Settings\Administrator\My Documents\" & lpfilename,
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub

to get the formatted date. (as displayed). However, you probably don't want
slashes in your filename, so you might use another format


lpfilename = format(Range("f7").Value,"yyyymmdd")


To put a quote in a text string

sStr = "The name of the book, ""The House on the Hill,"" was visible to all"

verifying in the immediate window:
sStr = "The name of the book, ""The House on the Hill,"" was visible to all"
? sStr
The name of the book, "The House on the Hill," was visible to all



--
Regards,
Tom Ogilvy



"Greg85374 " wrote in message
...
can someone help me with this?


Public lpfilename As String

Sub Macro1()

lpfilename = Range("f7")
ActiveWorkbook.SaveAs Filename:="C:\Documents and
Settings\Administrator\My Documents\" & lpfilename,
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub


I believe i need to put quotes on each side of lpfilename...I would
like also in general to know how to do somehting similar to """ (quote
inside quotes) for future reference....By the way F7 is a date
stamp..Thanks much again guys youve all been excellent!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel save AND concatenation problem

Thanks for the reply....the problem with putting quotes in the string
was too vague about...

ie..you put...
sStr = "The name of the book, ""The House on the Hill,"" was visible t
all"...


put suppose its a variable im calling on

ie...LpFileName....suppose ive an instance where it store the path of
file...how would i pute quotes around the output of the string ie....

LpFileName = app.path & range("f7")

now i want to call it
x = str(LpfileName)
now I WANT x to be "c:\whatever,1-2-04"
but it comes out as c:\whatever,1-2-04
without the quote

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default excel save AND concatenation problem

Greg,

Try

x = Chr(34) & CStr(Lpfilename) & Chr(34)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Greg85374 " wrote in message
...
Thanks for the reply....the problem with putting quotes in the string i
was too vague about...

ie..you put...
sStr = "The name of the book, ""The House on the Hill,"" was visible to
all"...


put suppose its a variable im calling on

ie...LpFileName....suppose ive an instance where it store the path of a
file...how would i pute quotes around the output of the string ie....

LpFileName = app.path & range("f7")

now i want to call it
x = str(LpfileName)
now I WANT x to be "c:\whatever,1-2-04"
but it comes out as c:\whatever,1-2-04
without the quotes


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel save AND concatenation problem

Bob answered you literal request, but to illustrate:

lpStr = Activeworkbook.Name
? lpStr
Book1
? workbooks(lpstr).Name
Book1
? workbooks(chr(34) & lpstr & chr(34)).Name

the last command gives an error because there is no workbook named "Book1"

--
Rgards,
Tom Ogilvy


"Bob Phillips" wrote in message
...
Greg,

Try

x = Chr(34) & CStr(Lpfilename) & Chr(34)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Greg85374 " wrote in message
...
Thanks for the reply....the problem with putting quotes in the string i
was too vague about...

ie..you put...
sStr = "The name of the book, ""The House on the Hill,"" was visible to
all"...


put suppose its a variable im calling on

ie...LpFileName....suppose ive an instance where it store the path of a
file...how would i pute quotes around the output of the string ie....

LpFileName = app.path & range("f7")

now i want to call it
x = str(LpfileName)
now I WANT x to be "c:\whatever,1-2-04"
but it comes out as c:\whatever,1-2-04
without the quotes


---
Message posted from http://www.ExcelForum.com/







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel save AND concatenation problem

I can't think of a single instance where I needed to put quotes around a
string from a variable. When you provide a variable to an argument looking
for a string, that is what the argument is looking for - it doesn't need
quotes around it. the quotes are only used when you are building string
constants. (as you see, the quotes are delimiters - they are not part of
the string).

--
Regards,
Tom Ogilvy

"Greg85374 " wrote in message
...
Thanks for the reply....the problem with putting quotes in the string i
was too vague about...

ie..you put...
sStr = "The name of the book, ""The House on the Hill,"" was visible to
all"...


put suppose its a variable im calling on

ie...LpFileName....suppose ive an instance where it store the path of a
file...how would i pute quotes around the output of the string ie....

LpFileName = app.path & range("f7")

now i want to call it
x = str(LpfileName)
now I WANT x to be "c:\whatever,1-2-04"
but it comes out as c:\whatever,1-2-04
without the quotes


---
Message posted from http://www.ExcelForum.com/



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
Excel Save-AS Problem Charles Barnum Excel Discussion (Misc queries) 0 February 12th 07 04:17 AM
Excel save as problem Gabor Excel Discussion (Misc queries) 3 February 23rd 06 04:35 PM
Concatenation Problem / VBA ? carl Excel Worksheet Functions 5 October 26th 05 07:35 PM
Problem using save as in Excel Dan Kilgore Excel Discussion (Misc queries) 0 April 27th 05 08:41 PM
Excel - Web Save Problem ksgoodwin Excel Programming 1 November 9th 03 01:54 PM


All times are GMT +1. The time now is 06:27 AM.

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"