Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I set the starting
Message
De
01/02/2006 12:57:04
 
 
À
01/02/2006 12:22:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Divers
Thread ID:
01092121
Message ID:
01092435
Vues:
22
I found this code from a piece of VBA code I used in an Excel add-in a while back. Maybe this is more along the lines of what you're looking for? Not everything within this IF block will be pertinant to you, but I'll just paste the whole thing in here so it makes sense in context.
        If ActiveWorkbook.Path = "" Or Not ActiveWorkbook.Saved Then
            fName = Application.GetSaveAsFilename(InitialFileName:= _
                ActiveWorkbook.Path & IIf(Not Trim(ActiveWorkbook.Path) = "", "\", "") & _
                ActiveWorkbook.Name, _
                FileFilter:="Excel Files (*.xls), *.xls")
            If fName = False Then
               MsgBox ("Must save workbook before running Import process.")
               importOK = False
            Else
                fName = Trim(fName)
                ActiveWorkbook.SaveAs Filename:=fName, _
                    FileFormat:=ActiveWorkbook.FileFormat
            End If
        End If
It will require some VBA-->FoxPro translation, but it looks like the GetSaveAsFilename method of the application object does what you want if you set the InitialFileName parameter to the appropriate value. Check the help file on that method to see the actual order that these named parameters are passed in order to translate to FoxPro correctly.

>It actually saves the spreadsheet. I've never looked at a running instance of Excel to see if it leaves that as the default for the next save, I don't have any user interaction with the spreadsheets, it's 100% automated, Excel isn't visible.
>
>
>>Fred --
>>
>>One last question. Does that actually save the spreadsheet? Or does it just set the full path for the name that it will be saved as if the user later decides to save it? (OK, that was really two questions, wan't it?)
>>
>>
>>>>Huh? How do I do that?
>>>>
>>>>>>How do I change the starting "Save As" folder for an Excel spreadsheet created using Automation? (I want to do so temporarily, not permanently). I do the following to get started:
>>>>>>
loExcel = Createobject("Excel.Application")
>>>>>>... but don't understand how I do "ChDir".
>>>>>>
>>>>>>Thanks in advance,
>>>>>
>>>>>Why not just specify the full path?
>>>
>>>Specify the fullpath name in the SaveAs:
>>>
>>>
oX.ActiveWorkbook.SaveAs(cFolder+cExcelFileName)
Paul A. Busbey
Victoria Insurance
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform