Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Automation Help
Message
De
02/04/2004 03:34:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00891618
Message ID:
00891692
Vues:
34
This message has been marked as the solution to the initial question of the thread.
>I've recorded an Excel macro which I'm trying to duplicate from VFP using Automation. I've got it all working except one thing:
>
>Selection.Insert Shift:=xlDown
>
>Here is the whole macro for reference:
>
>
>Sub create_new_week()
>'
>' create_new_week Macro
>' Macro recorded 10/7/2003
>'
>    Range(Selection, Selection.End(xlToRight)).Select
>    Range("A3:H8").Select
>    Selection.Copy
>    Selection.Insert Shift:=xlDown
>    Range("B4:H6").Select
>    Selection.ClearContents
>End Sub
>
>
>How can I automate Selection.Insert Shift:=xlDown?
>
>TIA

Michael,
This is exact copy of macro (dropping unncessary first line) :
#Define xlShiftDown	-4121
With ox.ActiveWorkBook.ActiveSheet
    .Range("A3:H8").Select
    .Application.Selection.Copy
    .Application.Selection.Insert(xlShiftDown)
   .Range("B4:H6").Select
   .Application.Selection.ClearContents
Endwith
And this is alternative (unlike macro you don;t need to work with Selection)
#Define xlShiftDown	-4121
With ox.ActiveWorkBook.ActiveSheet
    .Range("A3:H8").Copy
    .Range("A3:H8").Insert(xlShiftDown)
    .Range("B4:H6").ClearContents
*    .Range("B4:H6").Select && If you want to have it selected as macro does
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform