|
I'm trying to develop an excel add-in which generates certain reports which need me to add a pivot table. Below are 2 ways I have tried to do it the first one highlights an error "Reference to a non-shared member requires an object reference" and gives me an error on run time:
Dim PTCache As PivotCache = ThisApp.ThisWorkbook.PivotCaches.Create(SourceType:= _ Excel.XlPivotTableSourceType.xlDatabase, SourceData:=ws2.Range("A1").CurrentRegion.Address)
Dim PTable As Excel.PivotTable = ThisApp.PivotTables.Add(PivotCache:=PTCache, TableDestination:=_ ws3.Range("A1"), TableName:="DaPTable")
The second one just runs without any error but No pivot table created at the end:
m PTCache As PivotCache = ThisApp.ThisWorkbook.PivotCaches.Create(SourceType:= _ Excel.XlPivotTableSourceType.xlDatabase, SourceData:=ws2.Range("A1").CurrentRegion.Address). CreatePivotTable(PivotCache:=PTCache, TableDestination:=_ ws3.Range("A1"), TableName:="DaPTable")
Please Help where I'm getting it wrong or another better way of doing it.
|
|
|
|
|
Hi All,
I have created a ribbon to show in "new mail" or compose email window. This is a VB project.
I have three buttons:
- Add To : This adds an email address to the TO
- Add Subject : To add a text into the subject line of the new email
- Add Body : To add the message body.
These three button are available on the new mail windows. How do i get these buttons to work.
Any help is appreciated.
Regards,
Rahul
|
|
|
|
|
Member 13001124 wrote: How do i get these buttons to work. Most likely by writing some code. But without considerably more detail it is anyone's guess what you are trying to do.
|
|
|
|
|
Sorry for being vague.
I have a button on the newmail/compose windows in Outlook. When i click on templates, it should populate the To, CC, Subject and Body of the new email.I have attached a screenshot.
[^]
|
|
|
|
|
Your link is not correct. And I am afraid a picture is not going to tell us anything useful. What code executes when the button is pressed and what errors do you see?
|
|
|
|
|
Thats the problem. I am not sure what code should to use to insert subject line into the subject box of the new email.
I know how to call a new email and set the parameters. but in this case, the button is on the new mail window.
https://1drv.ms/i/s!Aqlv4pnf0jmdnX3WQdSkj-2q52op
|
|
|
|
|
You need to find the names of the properties that refer to those fields in the template. The best place to start would be the Outlook reference documentation.
|
|
|
|
|
Is there a way to make a call from a windows form? The company i work for now uses S4B. I would like to have a button on a form and when the user clicks on the button it will take a phone number from a label or textbox and open there S4B client and place the call. If anyone could point me in the right direction will be a big help.
|
|
|
|
|
Google[^] is the best place to start.
The first result even points you to the MSDN documentation[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When answering a question please:
Read the question carefully
Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
How to get an answer to your question[^]
In particular, #2: Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
You asked to be pointed in the right direction. I pointed you in the right direction.
Not sure how you think that's an insult?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Jason, there are a small number of really helpful people in the forums, Richard is certainly one of them, pointing out the guidelines for responding to a question is probably not a good idea (he may have been involved in formulating them).
One of the most irritating things is that people asking questions do not do even the most basic research, a search being the first thing to be done when trying to solve a problem.
He showed great restraint by not calling you a lazy pillock or other derogatory names while pointing you to a google search.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Countered
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
Thanks.
But I hope that was because you agreed with my post? I wouldn't want our new member thinking you were supporting me just because I've been here a while.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: you agreed with my post
Oh no, I don't agree with anyone just on principle Too many people run straight here when a simple google search would answer their question. But they would rather have someone else make the effort for them.
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
NotPolitcallyCorrect wrote: Oh no, I don't agree with anyone just on principle
Well, in that case, I think you're a marvellous person!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: you're a marvellous person
You will find no one on the face of the planet that would agree with that!
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
Hello,
Please help me to solve this problem. I tried to make a code to save a dwg file in pdf form.
These mesag of error belongs to me
AcadPlot: Not defined
AcadPlotConfigurations: type AcadPlotConfigurations no defined
AcPlotScale: AcPlotScale name not declared
Below the code:
Module Mdl_Print
Public Sub PDF_Print()
'Dim AutoCAD As Object
Dim AcadApp As Object
Dim AcadDoc As Object
Dim dirInfo As New DirectoryInfo(Frm_Main.LblFolder1.Text)
Dim fileInfo As FileInfo
Dim AcadApp As AcadApplication = New AcadApplication
AcadApp.Visible = True
AcadApp.WindowState = AcWindowState.acMax
Dim success As Boolean = False
For Each fileInfo In dirInfo.GetFiles("*.dwg") 'dwg for Autocad
AcadDoc = AcadApp.Documents.Open(fileInfo.FullName)
Dim oSS As AcadSelectionSet
oSS = AcadApp.ActiveDocument.SelectionSets.Add("oSS")
oSS.Clear()
Try
Dim ftype(0) As Int16
Dim fdata(0) As Object
ftype(0) = 410 'layout
fdata(0) = "A3 - ENGLISH"
oSS.Select(AcSelect.acSelectionSetAll, , , ftype, fdata)
Dim objPrefFiles As AcadPreferencesFiles
Dim PC3PathOld As String
Dim PC3PathNew As String
Dim PMPPathOld As String
Dim PMPPathNew As String
Dim PtConfigs As AcadPlotConfigurations
Dim PlotConfig As AcadPlotConfiguration
Dim PtObj As AcadPlot
Dim BackPlot As Object
'Set the preferences object
objPrefFiles = AcadDoc.Application.Preferences.Files
'Get the current Printer Config Path (pc3)
PC3PathOld = objPrefFiles.PrinterConfigPath
MessageBox.Show(PC3PathOld, "old Printer Config path (pc3)")
objPrefFiles.PrinterConfigPath = "C:\Users\ROBERT\Documents\Deb + Herve + Will\B - Herve\Technip\Autocad\1st project\OpenExcel\PC3 Files"
PC3PathNew = objPrefFiles.PrinterConfigPath
MessageBox.Show(PC3PathNew, "new Printer Config path (pc3)")
'Get the current Printer Desc Path (pmp)
PMPPathOld = objPrefFiles.PrinterDescPath
MessageBox.Show(PMPPathOld, "Printer Desc Path (pmp)")
objPrefFiles.PrinterDescPath = "C:\Users\ROBERT\Documents\Deb + Herve + Will\B - Herve\Technip\Autocad\1st project\OpenExcel\PMP Files"
PMPPathNew = objPrefFiles.PrinterDescPath
MessageBox.Show(PMPPathNew, "Printer Desc Path (pmp)")
PtObj = AcadDoc.Plot
AcadApp.ActiveDocument.AcPlotType.acExtents()
PtConfigs = AcadDoc.PlotConfigurations
''Add a new plot configuration
PtConfigs.Add("PDF", False)
'
''The plot config you created become active
PlotConfig = PtConfigs.Item("PDF")
''Use this method to set the scale
PlotConfig.StandardScale = AcPlotScale.acScaleToFit
''Updates the plot
PlotConfig.RefreshPlotDeviceInfo()
'Here you specify the pc3 file you want to use
PlotConfig.ConfigName = "Herve.pc3"
'You can select the plot style table here
PlotConfig.StyleSheet = "monochrome.ctb"
'You can select the Scale Line Weight
PlotConfig.ScaleLineweights = True
'Specifies Paper Size
PlotConfig.CanonicalMediaName = "ISO_A4_(210.00_x_297.00_MM)"
'Specifies whether or not to plot using the plot styles
PlotConfig.PlotWithPlotStyles = True
BackPlot = AcadDoc.GetVariable("BACKGROUNDPLOT")
AcadDoc.SetVariable("BACKGROUNDPLOT", 0)
'Updates the plot
PlotConfig.RefreshPlotDeviceInfo()
MessageBox.Show("scale" & PlotConfig.StandardScale)
MessageBox.Show("canonical media name" & PlotConfig.CanonicalMediaName)
MessageBox.Show("config name" & PlotConfig.ConfigName)
MessageBox.Show("plot type" & PlotConfig.PlotType)
MessageBox.Show("scale line weight" & PlotConfig.ScaleLineweights)
'Now you can use the PlotTofile method
If PtObj.PlotToFile(Replace(AcadDoc.FullName, "dwg", "pdf"), PlotConfig.ConfigName) Then
AcadDoc.Utility.Prompt(vbLf + "PDF Was Created")
Else
AcadDoc.Utility.Prompt(vbLf + "PDF Creation Unsuccessful")
End If
'If you wish you can delete the plot configuration you created programmatically, and set the 'BACKGROUNDPLOT' system variable to its original status.
PtConfigs.Item("PDF").Delete()
PlotConfig = Nothing
AcadDoc.SetVariable("BACKGROUNDPLOT", BackPlot)
objPrefFiles.PrinterConfigPath = "C:\Users\ROBERT\AppData\Roaming\Autodesk\AutoCAD 2014\R19.1\enu\Plotters"
objPrefFiles.PrinterDescPath = "C:\Users\ROBERT\AppData\Roaming\Autodesk\AutoCAD 2014\R19.1\enu\Plotters\PMP File"
oSS.Clear()
If AcadDoc.Saved Then
AcadDoc.Close(False)
End If
AcadDoc = Nothing
AcadApp.Quit()
AcadApp = Nothing
success = True
Catch ex As Exception
MsgBox(ex.Message + vbLf + ex.StackTrace)
success = False
End Try
' AcadDoc.Close()
AcadDoc = Nothing
' AcadApp.Quit()
Next
AcadApp.Quit()
End Sub
End Module
|
|
|
|
|
That code looks like VBA (Visual Basic for Applications).
With that you need the Microsoft Visual Basic for Applications module for AutoCAD.
If you are using .NET you have to install the AutoCAD .NET API and convert the code.
|
|
|
|
|
In a vb.net 2012 vb.net desktop application that I am opening for the first time, I am getting the following error and warning message:
Error 1 Resource file "My Project\Resources.resx" cannot be found.
Warning 2 A custom tool 'VbMyResourcesResXFileCodeGenerator' is associated with file 'My Project\Resources.resx', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool.
I tried to run the custom tool that was suggested in the warning message and that did not help.
Thus can you tell me what I can do to get the Resources.resx file that is missing?
Is there a way that I can paste a screen print of what the visual studio ide is to this post so that you can see it?
|
|
|
|
|
The file is missing. You need to get a copy of it from whoever created the project.
If you can't find a copy of the file, then you'll have to add a new resource file, and re-create all of the resources.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You mentioned the following ,"If you can't find a copy of the file, then you'll have to add a new resource file, and re-create all of the resources."
There is no resource file. Thus can you tell me how to create the resource file and recreate all the resources? I do not know how to create a resource file and I do not know how to re-create all of the resources. How can I tell what resources need to be added?
|
|
|
|
|
If you have no idea what was in the resources to begin with, there is very little in the code that's going to tell you. Resources are strings, files, icons, images, data, ... that your app uses. There is really no way for you to "figure out" what was in there.
The bottom line is you MUST find the missing file(s).
|
|
|
|
|
Or you could always the many, many things to try that you would have found using a simple google search.
Speed of sound - 1100 ft/sec
Speed of light - 186,000 mi/sec
Speed of stupid - instantaneous.
|
|
|
|
|
in property tab in your project --> Resoursces -->
delete the unused resource
|
|
|
|