Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel automation 101
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00543842
Message ID:
00543876
Views:
17
Thank you, thank you, thank you Andrew!!! This was extremely helpful advice, as I know now how to approach other VBA command issues.

I will find that tome by Della and Tamar and study it carefully.

Thanks again, mate...

Kindest regards,
Robin

>Hi Robin
>
>[snipped stuff]
>  * Insert a row
>  .Rows("5:5").Select                        && works
>  .Sheets.Selection.Insert <b>Shift:=xlDown</b>     && generates a compile error
>ENDWITH
>
>
>The problem is that you're using Excel Syntax - in particular:
>
  • you're trying to name parameters.
    >
  • you're not using parens in your method call
    >
  • you're using an excel type library constant name rather than its value
    >
    >To solve this, look up the vba help file for excel to find out where the shift parameter occurs in the Insert method's parameter list (it happens to be the first parameter in this case) and what the value for xlDown is (it's -4121 or 0xFFFFEFE7). This means you call should be:
    >
    >  .Sheets.Selection.Insert<b>(0xFFFFEFE7)</b>     && should no longer generate a compile error
    >
    >
    >You can also look up the parameters and constant values using the VBA object browser. Bring up the VBA IDE in excel (ALT+F11) and then the object browser (F2). Enter the method, property or constant name you're looking for in the second drop-down in the right-hand pane and it will give you all the details in the lists below.
    >
    >Finally, I'd highly recommend Della Martin and Tamar Granor's book available from Hentzenwerke - something like Microsoft Office Automation with Visual Foxpro. I got Amazon to ship mine out here (I don't think Whil ships direct here to Australia).
    >
    >Cheers,
    >
    >Andrew
  • Previous
    Reply
    Map
    View

    Click here to load this message in the networking platform