Solved

Write Code to save an Excel File

Posted on 2002-04-10
3
157 Views
Last Modified: 2010-05-02
How do I write code at the end of my macro that will automatically save a file after the macro does its task? This file will be located on each persons desktop for easy access.
After the macro assigns a PO number I want the file saved automatically (written in the code) and after each user fill out their order form it will be up to them to do a manual "Save As" to their proper folder.

here is my macro for further reference.....
 
Public Sub GetNewJobNumber()
Dim strJob As String
 strJob = InputBox("Enter job number")
 Worksheets("Access & Couplers").Range("I9") = strJob & "-" _ & Worksheets("PONumber").Range("A1")
 Worksheets("PoNumber").Range("A1:A1").Delete
 End Sub
0
Comment
Question by:He4Giv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:Ber
ID: 6932568
I think something like this should work

Public Sub GetNewJobNumber()

Dim strJob As String

strJob = InputBox("Enter job number")
Worksheets("Access & Couplers").Range("I9") = strJob & "-" _ & Worksheets("PONumber").Range("A1")
Worksheets("PoNumber").Range("A1:A1").Delete

ChDir "C:\WINDOWS\Desktop"
    ActiveWorkbook.SaveAs Filename:="temp.xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
End Sub

Cheers...
Ber...
0
 
LVL 5

Accepted Solution

by:
kcm76 earned 50 total points
ID: 6932586
How about just **Worsheets(X).save**

kcm
0
 

Author Comment

by:He4Giv
ID: 6932764
Yours didnt work but was close so I checked VB help and found the syntax to be....

ActiveWorkbook.Save

This saved the file for me

Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS expression Issue finding a string 10 101
MS Date Picker 64 bit 32 bit issue 12 64
Visual Studio 2005 text editor 10 49
VBA - If Bookmark = "XXBOOKMARKXX" then 15 51
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question