Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro button refers to prev. workbook

Hi,

When I create a macro in Excel, and assign a button to it, it works
fine the first time, but when I re-open the workbook for a second
time, and try to run the macro again, the macro seems to refer to the
previous workbook...For some reason, the macro saves the name of the
previous workbook...



Sub test()
'

Dim name As String
Dim adress As String


Sheets("sheet1").Select
Range("A1").Select

name = ActiveSheet.Range("B6").Value
adress = ActiveSheet.Range("B4").Value


ActiveWorkbook.SaveAs Filename:="C:\WINDOWS\Desktop\Temp\" & name
& "_map" & adress & "_" & ".xls", FileFormat:=xlNormal, Password:="",
WriteResPassword:=""

MsgBox ("done")
End Sub

maybe somebody can help?
thanks in advance,
Maja
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default macro button refers to prev. workbook

See one guess at your other post.

Maja wrote:

Hi,

When I create a macro in Excel, and assign a button to it, it works
fine the first time, but when I re-open the workbook for a second
time, and try to run the macro again, the macro seems to refer to the
previous workbook...For some reason, the macro saves the name of the
previous workbook...

Sub test()
'

Dim name As String
Dim adress As String

Sheets("sheet1").Select
Range("A1").Select

name = ActiveSheet.Range("B6").Value
adress = ActiveSheet.Range("B4").Value


ActiveWorkbook.SaveAs Filename:="C:\WINDOWS\Desktop\Temp\" & name
& "_map" & adress & "_" & ".xls", FileFormat:=xlNormal, Password:="",
WriteResPassword:=""

MsgBox ("done")
End Sub

maybe somebody can help?
thanks in advance,
Maja


--

Dave Peterson

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
Why is autofilter only filtering up to # of rows in prev column? Amanda Excel Discussion (Misc queries) 1 March 11th 09 01:36 PM
macro than refers to a cell? jackrobyn1 Excel Discussion (Misc queries) 1 June 18th 08 11:01 PM
Navigation with arrows eg next/prev pge in Excel? Harris John Excel Discussion (Misc queries) 8 October 29th 07 12:48 PM
find measure prev. day qty vs bus. hrs today/8.. nastech Excel Discussion (Misc queries) 6 July 10th 07 12:00 AM
Regarding Prev. Post. Sam Excel Discussion (Misc queries) 1 December 24th 06 07:17 AM


All times are GMT +1. The time now is 10:07 PM.

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"