View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
GS[_5_] GS[_5_] is offline
external usenet poster
 
Posts: 226
Default ActiveWorkbook.Save saves to wrong directory

Akihito Yamashiro laid this down on his screen :
Hi, Gary.
The same can be said of your idea.
How does the CustomProperty give the right path?


Hi Akihito,
This property would be normally set (manually) when the workbook is
created. The practise of using the CustomProperties is common where
workbooks belong to a specific addin and we want to store information
that identifies the workbook to the addin. In this case, the addin
could retrieve the CustomProperty where the author stored the path to
where the workbook is to be saved. This, of course, would be a string
value that may (or may not) include a preferred SaveAs filename.

An example of where this might apply is a XLT that gets opened
periodically by an addin for entering period data and then gets saved
to a specific folder. In this case the stored path would not include a
filename since it's likely the period date would be used in the
filename.

Another benefit of using this concept is that no file dialogs are
needed, and there's no chance for user input (erroneous or not) into
the process.

Otherwise, this info could (but not preferred) be stored in
workbook-level defined names. This could be a problem when copying
sheets between workbooks. Always using sheet-level names and
CustomProperties obviates any conflict issues rising from using
workbook-level names.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc