Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,441
Default 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
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
Strip workbook of macros, VBA, MS Query, etc. Paul Kraemer Excel Discussion (Misc queries) 4 September 7th 06 01:30 PM
Hide Macro's in Toolbar / Macro's list sparx Excel Discussion (Misc queries) 2 May 6th 06 08:53 PM
how do I run excel 4.0 macros on excel 2000 RodolfoDallas Excel Discussion (Misc queries) 1 March 12th 06 03:14 AM
Excel crashes while opening excel file imbeddied with macros ct2147 Excel Discussion (Misc queries) 0 December 30th 05 09:05 PM
Enabling macros Peter M Excel Discussion (Misc queries) 3 February 7th 05 10:57 PM


All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"