Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default saving file as personal.xls

I have the following macro that saves the active workbook
(without the extension .xls) in the same directory
with "For Reporting" attached to its name:

Sub SaveAsReporting2()
Dim stOldName As String
Dim stNewName As String
Dim stPartName As String

stOldName = ThisWorkbook.FullName
stPartName = Left(stOldName, Len(stOldName) - 4)
stNewName = stPartName & " For Reporting"

ActiveWorkbook.SaveAs stNewName
End Sub

However, something have must gone wrong with the personal
file, because when I run this macro, the "PERSONAL.XLS"
file (in the Microsoft/Excel/Startup directory on my C:
drive) is saved with "For Reporting" attached its name and
not the active workbook....

What did I do and how can I solve this problem????

Hans

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default saving file as personal.xls

Sorry for my previous email - problem solved. I shouldnt
have saved this macro in the PERSONAL.XLS macro file, but
only in the individual spreadsheet!


-----Original Message-----
I have the following macro that saves the active workbook
(without the extension .xls) in the same directory
with "For Reporting" attached to its name:

Sub SaveAsReporting2()
Dim stOldName As String
Dim stNewName As String
Dim stPartName As String

stOldName = ThisWorkbook.FullName
stPartName = Left(stOldName, Len(stOldName) - 4)
stNewName = stPartName & " For Reporting"

ActiveWorkbook.SaveAs stNewName
End Sub

However, something have must gone wrong with the personal
file, because when I run this macro, the "PERSONAL.XLS"
file (in the Microsoft/Excel/Startup directory on my C:
drive) is saved with "For Reporting" attached its name

and
not the active workbook....

What did I do and how can I solve this problem????

Hans

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default saving file as personal.xls

Hans

That's one way to solve the problem. The other is to use ActiveWorkbook
instead of ThisWorkbook. ThisWorkbook always refers to the workbook in
which the code resides. You could store this procedure in Personal.xls if
you used

ActiveWorkbook.FullName

instead.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Hans" wrote in message
...
Sorry for my previous email - problem solved. I shouldnt
have saved this macro in the PERSONAL.XLS macro file, but
only in the individual spreadsheet!


-----Original Message-----
I have the following macro that saves the active workbook
(without the extension .xls) in the same directory
with "For Reporting" attached to its name:

Sub SaveAsReporting2()
Dim stOldName As String
Dim stNewName As String
Dim stPartName As String

stOldName = ThisWorkbook.FullName
stPartName = Left(stOldName, Len(stOldName) - 4)
stNewName = stPartName & " For Reporting"

ActiveWorkbook.SaveAs stNewName
End Sub

However, something have must gone wrong with the personal
file, because when I run this macro, the "PERSONAL.XLS"
file (in the Microsoft/Excel/Startup directory on my C:
drive) is saved with "For Reporting" attached its name

and
not the active workbook....

What did I do and how can I solve this problem????

Hans

.



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
saving macros in personal workbook porbeagle Excel Worksheet Functions 1 March 30th 07 11:56 AM
saving styles into the personal workbook Louise Excel Discussion (Misc queries) 4 January 10th 07 03:29 PM
Saving Macro to Personal Workbook Chris Excel Discussion (Misc queries) 1 November 8th 06 08:41 PM


All times are GMT +1. The time now is 10:22 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"