[python-win32] Calling Excel function GetSaveAsFilename, parameter ignored
jasonveldicott at gmail.com
Wed Jul 13 08:36:24 CEST 2011
I am wanting to display a file "Save As..." dialog in Excel through Pywin.
I am doing this by calling
The problem however is that the parameter supplied to this function,
InitialFilename, seems to be ignored by Excel. Perhaps it's not getting
through to Excel. When VBA was used to call the same function, the initial
filename displayed correctly.
Not being able to specify an initial filename is inconvenient if not
unsatisfactory from application usability point of view, and one wonders if
other functions might also be affected. If anyone has any suggestions as
to why this might be happening, or even what a solution may be, I would be
glad to hear from you.
I am using Python 2.7 on Win 7, Office 2010 (v14), and a very recent stable
release of pywin (pywin32-216.win32-py2.7).
Code to recreate the problem:
app = Dispatch("Excel.Application")
app.GetSaveAsFilename(InitialFilename="filename.xlsx") # <<<<<<< THIS
PARAMETER IS IGNORED
Pywin generated function for the GetSaveAsFilename function (in which it can
be seen that the parameter InitialFilename is handled):
def GetSaveAsFilename(self, InitialFilename=defaultNamedOptArg,
return self._ApplyTypes_(1076, 1, (12, 0), ((12, 17), (12, 17), (12, 17),
(12, 17), (12, 17)), u'GetSaveAsFilename', None,InitialFilename
, FileFilter, FilterIndex, Title, ButtonText)
At the moment, development is stopped in its tracks, so comments are greatly
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the python-win32