Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.newusers
|
|||
|
|||
using a macros
Hi,
I'm new to using macros in excel (have only used the record function). I want to create a template with two buttons to carry out the following functions. Firstly I want to save the workbook in a folder called "active" by pressing a button. There may be several workbooks saved in this folder so I need to give each workbook a new name, perhaps using Save As. Secondly the I want to be able to open one of the workbooks in the "active" folder and press another button on the worksheet that will move the sellected workbook from the "active" folder to another folder "Completed" then close the sellected workbook |
#2
Posted to microsoft.public.excel.newusers
|
|||
|
|||
using a macros
Sub SaveInActive()
Dim myFileName As String ChDir "C:\Path\Active" myFileName = Application.GetSaveAsFilename If Not InStr(1, myFileName, ".xls") 1 Then myFileName = Left(myFileName, Len(myFileName) - 1) & ".xls" End If ActiveWorkbook.SaveAs myFileName End Sub Sub SaveInCompleted() Dim myFileName As String Dim myFullName As String myFileName = ActiveWorkbook.Name myFullName = ActiveWorkbook.FullName ActiveWorkbook.SaveAs "C:\Path\Completed\" & myFileName Kill myFullName ActiveWorkbook.Close End Sub HTH, Bernie MS Excel MVP "Sadcrab" wrote in message ... Hi, I'm new to using macros in excel (have only used the record function). I want to create a template with two buttons to carry out the following functions. Firstly I want to save the workbook in a folder called "active" by pressing a button. There may be several workbooks saved in this folder so I need to give each workbook a new name, perhaps using Save As. Secondly the I want to be able to open one of the workbooks in the "active" folder and press another button on the worksheet that will move the sellected workbook from the "active" folder to another folder "Completed" then close the sellected workbook |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Strip workbook of macros, VBA, MS Query, etc. | Excel Discussion (Misc queries) | |||
Hide Macro's in Toolbar / Macro's list | Excel Discussion (Misc queries) | |||
how do I run excel 4.0 macros on excel 2000 | Excel Discussion (Misc queries) | |||
Excel crashes while opening excel file imbeddied with macros | Excel Discussion (Misc queries) | |||
Enabling macros | Excel Discussion (Misc queries) |