VB code to Save_as_Filename

Currently I have a workbook named "new job" that sales reps open t
input a new job. there is a command_button on the S-1 to "Save job"

Sub Save_As_FileName()

FName1 = Range("d2").Value   *customer name
FName2 = Range("d3").Value   *subdivision
FName3 = Range("d5").Value   *lot number
FName4 = Range("d6").Value   *address
Fname5 = Range("d7").Value   *sales rep (bdg, ear, gjg or jpr)
pth = "f:\bids\"
ActiveWorkbook.SaveAs Filename:=pth & FName2 & "  " &      
FName3 & "  " & FName4 & "  " & Fname5 & "  " & FName1    
& ".xls", _
FileFormat:=xlNormal, CreateBackup:=False
End 

my problem is in the path. In "f:\bids\" I have 4 folders (directories
named bdg, ear, gjg and jpr. depending on what text is in Fname5 is th
folder i want it saved to. 

Is there a way to do this? 

I tried

pth = "f:\bids\<space>&<space>Fname5" but it doesn't seems to b
working.

any help would be greatly appreciated

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

0
6/21/2004 12:20:00 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
190 Views

Similar Articles

[PageSpeed] 22

Perhaps you need to add & "\"

-- 
Don Guillett
SalesAid Software
donaldb@281.com
"Zygoid >" <<Zygoid.1879za@excelforum-nospam.com> wrote in message
news:Zygoid.1879za@excelforum-nospam.com...
> Currently I have a workbook named "new job" that sales reps open to
> input a new job. there is a command_button on the S-1 to "Save job"
>
> Sub Save_As_FileName()
>
> FName1 = Range("d2").Value   *customer name
> FName2 = Range("d3").Value   *subdivision
> FName3 = Range("d5").Value   *lot number
> FName4 = Range("d6").Value   *address
> Fname5 = Range("d7").Value   *sales rep (bdg, ear, gjg or jpr)
> pth = "f:\bids\"
> ActiveWorkbook.SaveAs Filename:=pth & FName2 & "  " &
> FName3 & "  " & FName4 & "  " & Fname5 & "  " & FName1
> & ".xls", _
> FileFormat:=xlNormal, CreateBackup:=False
> End
>
> my problem is in the path. In "f:\bids\" I have 4 folders (directories)
> named bdg, ear, gjg and jpr. depending on what text is in Fname5 is the
> folder i want it saved to.
>
> Is there a way to do this?
>
> I tried
>
> pth = "f:\bids\<space>&<space>Fname5" but it doesn't seems to be
> working.
>
> any help would be greatly appreciated.
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


0
Don
6/21/2004 1:26:11 PM
Reply:

Similar Artilces:

Sheet Protection and VBA Code
Does anyone know how to get Excel to allow VBA code to write to a password protected worksheet? I am using a work-around solution at the moment whereby the VBA unprotects the relevant worksheet, writes data to it, then re-protects it. There must be a better way than this though. Obviously I don't want my users to delete the formulas etc in the worksheet but I want my code to be able to write data to the worksheet without having to unprotect/re-protect it all the time! Thanks -Rob -- TheRobsterUK ------------------------------------------------------------------------ TheRobsterUK&...

Getting attribute value in vb code not working...please help
Hi, sorry I've asked similar questions, but still having trouble. I'm using asp.net (vb.net). I select a node from an xmlDoc string (I've made sure that the intended item exists), then want to determine if that node exists, then get a certain attribute value and assign that to a variable. Simple. But when I run it (including debug with breaks) no value gets assigned...it just skips from my If... line to the code after the End If. Similar code works if I'm looking at previous-sibling, but no following-sibling so I was hoping someone could at least tell me that my xpath looks ok...

Moving down one row using VB
Hello, I am currently stuck and wondering if anyone can offer a solution to the following problem: I am trying to copy the contents of a particular cell into the cell below it. The cell contents are non changing but its location in the workbook various on each report. So far I have set up a macro to find the cell and copy its contents. However for the life of me I cannot now get the macro to simply drop one row and paste the contents of the copied cell into the cell below. Any advice would be greatly appreciated. Thanks Geoff Hey geoff try this ActiveCell.Offset(1, 0).Ran...

userform in the VB environment
Hi, In Excel 2007 I created a userform in the VB environment. Yet, in the properties I can find a item where you can turn on the max/min button or even show one. Does anyone know how these can be turned on? You need to add a control button. then in the properties window (view Properties) change the caption of the control button to the text that you want to apper on the button. then in the button click function wite your own code to get the min or max values. -- joel ------------------------------------------------------------------------ joel's Profile: 229 View t...

Stopping VBA code when it hits the last row
I have a list of data the is in 4 columns, and the number of rows will vary from week to week.. Columns A-C are filled with data, and Column D will only have data in certain cells (ie, row 6 could have a value and then the next row to have a value could be row 20...and this value may or may not be different than the value in row 6). I am trying to wrote code that will fill in the blanks in column D, so it would copy the value in row 6 to all blank cells below it until is finds another value (7-19 in my example). Then it will find the next value and copy that to all blank rows below i...

How to write networking code in VBA?
I am quite familiar with BSD networking API. But I don't know the first thing about network programming in VBA. I've done a Google search, and I will continue to do so. But so far, I have not found a concrete example (that I can access). I would very much appreciate some hand-holding. Here is what I want to do in a macro. It's really very rudimentary. on error goto done connect(TCP) to ipAddress:portNumber for each line (read from a file or otherwise provided by the macro) send line (terminated by \r\n on the wire) recv response (one line terminated by \r...

is it possible to run code written inside a cell
Is it possible to run code written inside a cell, for example, cell A1 I wrote MsgBox "Hi i am David" When I run the code it has show the message Hi i am David or else order written in A1 any help appreciated in advance. thanks Hi Your example does not have any code written inside a cell, so hard to know what you want. If you want to show the text in A1 in a msgbox you could use Function ShowIt(myCell as Range) as Variant ShowIt =3D MsgBox(myCell.Value) End function and run the sub Sub RunShowIt() ShowIt Range("A1") End Sub If you really want to ru...

Need code to Autofit Row Height on recalculation
Among others, I'm having some trouble getting Jim Rech's code to Autofit Row height in merged cells to work the way I want it to. Is there a simple worksheet event code I could use to Autofit Row in four cells, preferably upon recalculation? Specifically, A:N are merges in four different rows, 23, 47, 68, and 70 The width of column Column Z is is the same as A:N combined Z23 is =A23 Z47 is =A27 etc. Autofit doesn't automatically work in Z23 because of the formula, in fact, F2 Enter doesn't even work. I have to paste values or select the cells and Alt O R A. I should figur...

HTML Code for filtering a table
I don't know which heading I should put this under, so I'll try here. I have the following code string: <input type="text" name="find:/> I would like to make this allow me to enter a word in the box and then look in the column of the table to find any cell that CONTAINS that word. Right now, it is only finding cells that have only the exact word. Does anyone know how to do this?? Thanks ...

VBA code to locate cell address of AutoFilter dropdown box
XL 2003 What VBA code line would return the cell address of the cell containing the AutoFilter dropdown box in a particular column The line below does not work but gives an idea what I am looking for. ActiveSheet.Autofilter.Address Dennis Dennis, Try the code below. HTH, Bernie MS Excel MVP Sub Test() Dim i As Integer Dim mySheet As Worksheet Set mySheet = ActiveSheet Dim myFilters As String myFilters = "" For i = 1 To mySheet.AutoFilter.Range.Columns.Count If mySheet.AutoFilter.Filters(i).On Then myFilters = myFilters & mySheet.AutoFilter.Range _ .Cells(1, i)...

code
I made a big mistake I threw away my access code and my numbers of uses is fading away which i just got the darn laptop what can i do to get another one please help What access code? Without the product key you couldn't have installed the software. So, that cannot be what you are referring to. If you mean activation code, there isn't any. You need to connect to the Internet and the software will communicate with the mother ship. Or, call MS; the activation dialog box should give you the number to call. -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and ...

VBA code for selecting records by date
I have the following code behind a 'Print' button. Dim strDocName As String Dim strWhere As String Dim YrStart As Date Dim rst As Recordset Set rst = CurrentDb.OpenRecordset("AttendanceCtrl") YrStart = rst!FirstDay strDocName = "Contact" strWhere = "[StudentID] =" & Me!StudentId & "AND [Calls].[CallDate] >= " & YrStart DoCmd.OpenReport strDocName, acPreview, , strWhere Table 'AttendanceCtrl' contains the start of the year and Ta...

Excel Programming in VB
I want to program Excel in VB to open an existing Excel file and edit some custom cells so new updated data for those cells are entered. Can some help me with some suggestions or codes? THanks I think I'd start by recording a macro when I did it manually in Excel. Then the next question: Do you really mean VB or VBA? ms newsgrp wrote: > > I want to program Excel in VB to open an existing Excel file and edit some > custom cells so new updated data for those cells are entered. > > Can some help me with some suggestions or codes? > > THanks -- Dave Peterson ...

Mqcro loop / password code /
Hey guys I've made a summary-file to collect data from several files in a commen folder. So far I've hardcoded my macro to pick up the datas from every singel- named file. The same prosedyre is used on every singel file. This must be wiser to perform this by using a loop-statement...but how? There are 9 separate files to handle (I show my reference to the 2 of them) Some of the files may be protected by password. Are there any way to "tell" the macro to still open it? When running my primitiv macro a messagebox pops up and say there is a lot of copyed data on the clipboard. I...

Code-Copy & Paste in Text Boxes
Thanks Jon, I am trying to copy and paste the data in columms A,C and into each text box that was selected in columm E. (by the code yo described)Thus, data for example from A1,C2 and D1 will be pasted int the text box appearing in E1. And so on.... So a code that will do tha for every text box that is in columm E?? This is a part of my code: ActiveSheet.Shapes.Range(shape_names).Select Selection.ShapeRange.ZOrder msoBringToFront ActiveSheet.Shapes.Range(shape_names).Select ActiveCell.FormulaR1C1 = "11/3/2000" ActiveSheet.Shapes.Range(shape_names).Select Selection.Characters.Text ...

Office 2007 SP1 Update Error Code 92D for Update KB950114 Publishe
I just ran a clean install of Vista and Office 2007 SP1 on my laptop. Everything went smoothly until this update came up: KB950114 for MS Publisher 2007. This error comes up: Error Code 92D I can not install this update, nor can I hide it. I have tried installing the update directly from the Microsoft website, but the update will still not install. I have tried restarting the computer numerous times to install the update. I have run antivirus software, and am about to run anti-spyware/anti-malware software to see if this is just some kind of fake update. My version is an academic copy...

Convert Hard-coded cell values to constants
Gang - If you have not guessed, I manage deer - lots of them in lots of counties. For that reason, I'm trying to automate my population models. In short, what I've developed is a simple accounting-style population model that begins with a known population in 1981 and attempts to mimic/model/simulate/track the population through time. The population is composed of 6 age/sex classes. We'll use fawn does as an example. The name "accounting" comes from the fact that the model is like a simple checking account, with simple deposits and withdrawals. As you might imagine, w...

Help with code.
Thanks to Databasedev.co.uk I have the following code. However for some reason the month portion does not work. Any ideas. Private Sub cmdmonth_Click() 'Sets the Date From and Date To text boxes 'to show complete month (from start to end of current month) Me!txtdatefrom = CDate("01/" & Month(Date) & "/" & Year(Date)) Me!txtDateTo = DateAdd("d", -1, DateAdd("m", 1, Me!txtdatefrom)) End Sub Private Sub cmdyear_Click() 'Sets the Date From and Date To text boxes 'to show complete current year Me!txtdatefrom = CD...

In Excel VBA Editor, how do I hide my code from other users?
Is there a way to password protect my code in VBA in MS Excel (the Visual Basic Editor)? Mayberrk, In the VBE, Tools - VBA Project Properties - Protection tab - Lock project for viewing. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Mayberrk" <Mayberrk@discussions.microsoft.com> wrote in message news:7E828D2F-F3E1-4AB6-99B5-B2F4BCD77A09@microsoft.com... > Is there a way to password protect my code in VBA in MS Excel (the Visual > Basic Editor)? ...

Toggle button code to insert user response into template
Hello, I've created a User Form to create content for a letter. This is the first time I've ever used VB - I'm a complete Newbie - and I've had a lot of help using an article I found online. I have included toggle buttons in the form and what I would like them to do is insert text into the letter when they're selected, but if they're not selected, then the space where the bookmark is in the letter remains blank. This is the segment of code that concerned the toggle button and what the bookmark was supposed to fill in with: If togPartAwardsText.Value ...

excel: How can I color code rows based on a value in a cell?
Jexample: If the value in cell J2=P, then shade the entire row in yellow. 1. Select row 2. 2. Go to Format > Conditional Formatting. Select "Formula Is" 3. Insert: =$J$2="P" 4. Click the "Format" button and format as desired. HTH Jason Atlanta, GA >-----Original Message----- >Jexample: If the value in cell J2=P, then shade the entire row in yellow. >. > Parker Select the entire row to color. Doesn't have to be row 2. Format>Conditional Formatting>Formula is: =$J2="P" Pick a color from from the Format button. Note the ...

Code to "white-out" specific lines in a very large Word document
Hi For the lines that start with the following text, I'd like like to change the font colour of the ENTIRE line to white: - Diagnosis: - Rating: - Analogue: (note the colon [:] at the end in each case) Thanks very much John If by 'line', which is a vague concept, you mean 'paragraph' then Dim vFindText Dim oRng As Range Dim i As Long vFindText = Array("- Diagnosis:", "- Rating:", "- Analogue:") For i = 0 To UBound(vFindText) Set oRng = ActiveDocument.Range With oRng.Find .Text = vFindText(i) ...

RMS 2.0 omission/bug -- no reason code needed for changing QTYs in Matrix Quantity View!
Doh. One can change quantities of items in the Matrix Quantity View window without being asked for a reason code. That could allow for theives to hide their tracks! ______________________________________________________ Larry Leveen OlyBikes Bikes, Parts, Repairs & GREAT Customer Service! 124 State Avenue NE Olympia, WA 98501 P: 360-753-7525 F: 360-528-7526 info@olybikes.com www.olybikes.com Featuring free bike advocacy and safety materials! Tested on my laptop and it prompts me for a reason code when I clicked OK after manually changing quantities in the quantity view tab of a...

VBA Code User Range Selection
I have a current VBA and I would like to extend it to do the following after the last command:- allow a user to select a un pretermined range for deletion (could be any number of coumns and rows) and for the macro to delete that range and either restart the macro to continue with it's next command or alternatively to stop via perhaps a message box instruction for the user . -- hopalong Hi, Try this, when the input box pops up simply drag to select a range Set deleterange = Application.InputBox(prompt:="Select a range of cells", Type:=8) Mike "j...

Restored Emails only display html code
After a data loss the users .pst files were restored, and now any of the restored emails open but show the complete html code for the email body. Outlook 2003 will not pick this up and display it correctly using the Word editor. All new emails received after the restore are displaying properly. Opening, reading, forwarding the email just shows the complete text starting <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META content="MSHTML 6.00.2...