LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default replace special character for filename save

venname = replace(Worksheets("Sales").Range("B2"),"&","")
vennumber = replace(Worksheets("Sales").Range("B3"),"&","")
venyear = replace(Worksheets("Data").Range("J15"),"&","")
venperiod = replace(Worksheets("Data").Range("J16"),"&","")



"anduare2" wrote:

Some of my venname data contains an "&" in them. When one is selected from a
dropdown list, it populates cell B2. When the macro runs to save the file I
need to replace the & with the text "and" so my file save routine will not
bomb. But if there is no & in the name I need it to continue on to the save.
It seems like a simple if:then:if:endif would fix it, but I just can't get a
handle on the dim/set value items to get it to replace / what / replacement
code to work for just one instance. Maybe I am looking at it all backwards
again? Here is a list of the macro/code I have pieced together


'Procedure to save the Sales Workbook to the Sharepoint Library

Sub SaveWork()

Dim venname As String
Dim vennumber As String
Dim venyear As String
Dim venperiod As String

venname = Worksheets("Sales").Range("B2")
vennumber = Worksheets("Sales").Range("B3")
venyear = Worksheets("Data").Range("J15")
venperiod = Worksheets("Data").Range("J16")

ActiveWorkbook.SaveAs
Filename:="HTTP://teams.kedc.org/mst/Sales_Reports/" & venname & "_" &
vennumber & "_" & venyear & "_" & venperiod & ".xls"
MsgBox "File was saved as " & ActiveWorkbook.Name
End Sub


If possible please include as much detail in example, I am slightly macro
literate but vb ignorant.

Much Appreciated

Martin

 
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
Special Character FARAZ QURESHI Excel Discussion (Misc queries) 2 May 18th 07 10:13 PM
Can I create a special character for the Character Map? JohnP Excel Discussion (Misc queries) 3 December 24th 06 01:10 AM
Save Special Filename Multiple Times DTTODGG Excel Programming 1 October 3rd 06 07:47 PM
Special Character Henry Excel Discussion (Misc queries) 1 July 25th 06 01:02 PM
Special Character Stuart[_5_] Excel Programming 2 December 15th 04 03:30 PM


All times are GMT +1. The time now is 08:50 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"