Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

create a pivot table from visual basic

Posted on 2013-12-10
1
Medium Priority
?
576 Views
Last Modified: 2013-12-10
Hi Experts,
Please your help with some code to créate a pivot table from visual basic in excell
Here is what I have working until opening the Excel file with  the data

        Imports Excel = Microsoft.Office.Interop.Excel
        Dim XL As excel.Application
        XL = New excel.Application                                    
        XL.Visible = True
        XL.WindowState = excel.XlWindowState.xlMaximized
        Dim w2 As excel.Workbook = XL.Workbooks.Open(ss_tmp_fdr & "REP_C5.XLS")  

Everything else I have tred to créate the pivot table does not work

Regards!
0
Comment
Question by:RGuillermo
1 Comment
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 39709594
My advice: turn on Excel's macro recorder, build the PT, and then use the auto-generated code as a guide.  You'll have to tweak it just a bit to conform to the VB.Net syntax, but that is the path of least resistance.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question