Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why is autofilter only filtering up to # of rows in prev column? | Excel Discussion (Misc queries) | |||
macro than refers to a cell? | Excel Discussion (Misc queries) | |||
Navigation with arrows eg next/prev pge in Excel? | Excel Discussion (Misc queries) | |||
find measure prev. day qty vs bus. hrs today/8.. | Excel Discussion (Misc queries) | |||
Regarding Prev. Post. | Excel Discussion (Misc queries) |