Excel + COM+

Nalij_isPower

New Member
Joined
Aug 16, 2007
Messages
3
Excel + COM+
1. I am trying to code the Autofilter process in my script using COM+.
I can open autofilter, how do you select? The VB code does not work for COM+.
2. Is there a site with examples for scripting Excel with COM+?
3. Is there a site that show the difference in the commands needed to code Excel COM+ vs Excel VB?

Below is the code I am trying to use.

Dim ExcelApp,ExcelBook,ExcelSheet as variant
Dim Field, Criteria1 as string
Dim BULDNME as string
BULDNME="D"
.
.
.
ExcelBook.WorkSheets("Sheet2").Range("a:a").AutoFilter ' Autofilter on
ExcelBook.WorkSheets("Sheet2").Range("a:a").AutoFilter Field:=1,Criteria1:=BULDNME

Thanks for your time.
D.
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700
Hello, welcome to MrExcel. :)

No need to select anything, the following should work just fine with VB6:

Code:
Sub foo()
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Add
With xlApp.Workbooks(1).Worksheets(1)
    Let .Range("A1:A6").Value = _
        xlApp.[{"Test";1;2;1;2;1}]
    .Range("A:A").AutoFilter 1, 1
End With
xlApp.Visible = True
Set xlApp = Nothing
End Sub
Yes-no? :wink:
 

Nalij_isPower

New Member
Joined
Aug 16, 2007
Messages
3
Thank you for your response,
I am learning as I go, I am a beginner with VB + Com+
Is VB6 the same as COM+,

The example did not work for me. I got the error message unexpected Token Expected: -=

I am using a client based (GUI) application, which has the ability to interface with Excel using COM+.

I am also waiting for a call back from our vendor on this question.

Thanks
D
 

Nalij_isPower

New Member
Joined
Aug 16, 2007
Messages
3
FYI,

The following worked:

Field = 1
SelectionCriteria = "Dana"

ExcelBook.WorkSheets("Sheet2").Range("A1:A6").AutoFilter(Field, SelectionCriteria)
 

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700
So, the only difference is that you need ()s for the arguments? All righty then. Don't try that with VBA... :confused:

Thanks for following up and glad to hear this is sorted. :)
 

Watch MrExcel Video

Forum statistics

Threads
1,123,259
Messages
5,600,574
Members
414,390
Latest member
plimbu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top