Search Results

Search found 1188 results on 48 pages for 'vba to c'.

Page 5/48 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Spreadsheet component with VBA support

    - by Renaud Bompuis
    I am looking for a .Net spreadsheet component that could also execute the VBA contained in Excel files. I found Spreadsheet Gears to be very nice for manipulating and allowing the user to edit Excel files, but on spreadsheets that use VBA for calculations, well, these don't work. So, apart from Excel itself, are there any other components that can execute VBA?

    Read the article

  • C++/CLI com-Interop: Exposing a reference type property to VBA

    - by Adam
    After long hours of investigation on exposing C# property that accepts a reference type to VBA, I concluded that it was not possible. In brief, a C# property that is of type double[] or even an object cannot be consumed in VBA like this: ' Compile Error: Function or interface marked as restricted, ' or the function uses an Automation type not supported in Visual Basic oComExposedEarlyBinding.ObjectArray = VBArray ' Run-time error 424: Object required oComExposedEarlyBinding.PlainObject = VBArray Or for more details: C# property exposed to VBA (COM) : Run-time error '424': Object required I would like to know if C++/CLI would support such an option? i.e. Allowing a reference-type property to be exposed to VBA so that a syntax like the above is valid. N.B. You can achieve this by using late binding, but losing the intellisense is not an option.

    Read the article

  • Programatically rebuild .exd-files when loading VBA

    - by aspartame
    Hi, After updating Microsoft Office 2007 to Office 2010 some custom VBA scripts embedded in our software failed to compile with the following error message: Object library invalid or contains references to object definitions that could not be found. As far as I know, this error is a result of a security update from Microsoft (Microsoft Security Advisory 960715). When adding ActiveX-controls to VBA scripts, information about the controls are stored in cache files on the local hard drive (.exd-files). The security update modified some of these controls, but the .exd-files were not automatically updated. When the VBA scripts try to load the old versions of the controls stored in the cached files, the error occurs. These cache-files must be removed from the hard drive in order for the controls to load successfully (which will create new, updated .exd-files automatically). What I would like to do is to programatically (using Visual C++) remove the outdated .exd-files when our software loads. When opening a VBA project using CApcProject::ApcProject.Open I set the following flag:axProjectThrowAwayCompiledState. TestHR(ApcProject.Open(pHost, (MSAPC::AxProjectFlag) (MSAPC::axProjectNormal | MSAPC::axProjectThrowAwayCompiledState))); According to the documentation, this flag should cause the VBA project to be recompiled and the temporary files to be deleted and rebuilt. I've also tried to update the checksum of the host application type library which should have the same effect. However none of these fixes seem to do the job and I'm running out of ideas. Help is very much appreciated!

    Read the article

  • Using Excel VBA to capture standard toolbar use

    - by vwankerl
    I am looking for a way to capture a click on a standard toolbar tool in Excel with VBA. The primary need is to capture any Copy, Cut, and Paste request by the user. I can capture the hot keys for these functions, but I can't find a way to capture the same functions when the user clicks on the icon on the standard toolbar or when the user uses the menu to select the function.

    Read the article

  • Populating Specific Cells Using VBA

    - by Daniel
    I am using VBA to pull from a SQL table and it automatically populates cell E14. Not sure why it's that cell, but is there a way to specify which cell it pulls the data into? Here's what I have right now: strSQL = "SELECT distinct Source FROM dbo.Simulations WHERE SimulationID = 5

    Read the article

  • Outlook 2007 VBA/Macro

    - by user27538
    Hi, I am a very basic user new to macros and vba. My problem is that I recive online orders to which i need to click an auto generated unique order hyperlink to confirm receipt of the order within a specified time period. This is a mundane task having to be on 'standby' and was wondering if there was a way to have this link automatically clicked when the email arrives. Just to reiterate the link has a unique reference and is different on each email. Please bare in mind that I am a very basic user and would probably require step by step instructions. Many thanks in advance

    Read the article

  • Insert Hyperlink via VBA

    - by Martin
    I have a Word VBA macro that loops through a directory and writes down the file path of files selected for some criteria into a new Word document. Works well as plain text (as part of a loop): wdDocResults.Content.InsertAfter objFile.Path & Chr(13) However, I'd like them to be hyperlinks. The following works as single macro, but when called from within another script, it does nothing at all (no matter if path is provided as variable or string, or as H:... or \\MyServernameAsNetDrive...): ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= objFile.Path, _ SubAddress:="", ScreenTip:="", TextToDisplay:=objFile.Path If try to select the current line in order to make sure something is selected at the right place -- error: out of memory": wrdDocResults.Content.InsertAfter objFil.Path Selection.Expand wdLine ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= objFile.Path, _ SubAddress:="", ScreenTip:="", TextToDisplay:=objFile.Path I also tried inserting a string resembling the Hyperlink field code ({ Hyperlink "..." }, which is of course not recognized... Any help is appreciated... Thanks in advance!

    Read the article

  • Need to pull data from website after every 5 seconds using Vba

    - by Milton
    I need to pull data from www.dsebd.org after ever 5 seconds. this Vba code pull data but does not run automatically. Please help me. Sub ButtonCode() ' execute macros Call GetCotton ' submit macro to run again in 5 sec Application.OnTime Now + TimeValue("00:00:05"), "ButtonCode" End Sub Sub GetCotton() Dim xml As Object Dim html As Object Dim elemcollection As Object Dim result As String Dim t As Long, r As Long, c As Long, ActRw As Long Set xml = CreateObject("MSXML2.XMLHTTP.6.0") With xml .Open "GET", "http://www.dsebd.org/dseX_share.php", False .send End With result = xml.responseText Set html = CreateObject("htmlfile") html.body.innerHTML = result Set elemcollection = html.getElementsByTagName("table") For t = 0 To elemcollection.Length - 1 For r = 0 To elemcollection(t).Rows.Length - 1 For c = 0 To elemcollection(t).Rows(r).Cells.Length - 1 ThisWorkbook.Sheets("Sheet1").Cells(ActRw + r + 1, c + 1) = elemcollection(t).Rows(r).Cells(c).innerText Next c Next r ActRw = ActRw + elemcollection(t).Rows.Length + 1 Next t End Sub

    Read the article

  • How can I loop through every letter in MS Word using VBA?

    - by Behrooz Karjooravary
    I have about 100 ms word documents which include transliteration of foreign names. The author of these docs used a special font called e2 which has about a dozen special transliteration characters (all of which are available in ms sans serif font). I would like to loop through every letter of the document and whenever the font = e2 i would like to loop through the dozen letters (it's easy to guess what they are) and replace them with a Microsoft Sans Serif equivalent. But I can't figure out how you can loop though letters. Is that doable like looping through cells in an excel spread sheet?

    Read the article

  • MS Access 2003 - Is there a way to programmatically define the data for a chart?

    - by Justin
    So I have some VBA for taking charts built with the Form's Chart Wizard, and automatically inserting it into PowerPoint Presentation slides. I use those chart-forms as sub forms within a larger forms that has parameters the user can select to determine what is on the chart. The idea is that the user can determine the parameter, build the chart to his/her liking, and click a button and have it in a ppt slide with the company's background template, blah blah blah..... So it works, though it is very bulky in terms of the amount of objects I have to use to accomplish this. I use expressions such as the following: like forms!frmMain.Month&* to get the input values into the saved queries, which was fine when i first started, but it went over so well and they want so many options, that it is driving the number of saved queries/objects up. I need several saved forms with charts because of the number of different types of charts I need to have this be able to handle. SO FINALLY TO MY QUESTION: I would much rather do all this on the fly with some VBA. I know how to insert list boxes, and text boxes on a form, and I know how to use SQL in VBA to get the values I want from tables/queries using VBA, I just don't know if there is some vba I can use to set the data values of the charts from a resulting recordset: DIM rs AS DAO.Rescordset DIM db AS DAO.Database DIM sql AS String sql = "SELECT TOP 5 Count(tblMain.TransactionID) AS Total, tblMain.Location FROM tblMain WHERE (((tblMain.Month) = """ & me.txtMonth & """ )) ORDER BY Count (tblMain.TransactionID) DESC;" set db = currentDB set rs = db.OpenRecordSet(sql) rs.movefirst some kind of cool code in here to make this recordset the data of chart in frmChart ("Chart01") thanks for your help. apologies for the length of the explanation.

    Read the article

  • MS Access 2003 - Failure to create MDE file: error VBA is corrupt?

    - by Justin
    Ok so this is a brand new snag I have run into. I am trying to launch a new MDE from my source MDB file, and it is locking up Access. So in my mdb, I am first compacting and repairing, and then selecting create a new mde (just as I have done many times before). It looks like it is starting the process, but never gets to where it compacts when it is done, and access is not responding. So after I force close the app, I look in the folder where I am trying to create the MDE to and I see there is a new access db1 file there. If I try to open that it gives me an error that says file not found, and then it says the Visual Basic for Applications is corrupt. The thing is, I just made a very simple adjustment to the code since last launching an mde, and after this I double and triple checked it...its not that because its just a simple open this form and close this one addition. I did however have my source mdb file on a disc that I copied to my laptop, and then tried to re link the tables to the network drive (had them linked to other tables on my local drive so that I could develop offline)?? PLEASE HELP!!!

    Read the article

  • ACCESS 2003 Excel 2003 : VBA for opening Excel file from Access and copying a pictre from excel the

    - by Justin
    So I have an excel workbook that has a nice global map of shaperange objects. With some very simple code I can change the colors, group and ungroup collections of countries into arrays, etc...and it works pretty well. However, I would like to bring this into Access. So I could copy and paste all the shapes into an access form manually, but then they become pictures and I cannot change the colors of the countries (shaperange objects) to have the map act interactively as I can in excel. So I am thinking that I know how to use excel functions from access, and how to open excel from access. Is there a way to copy an object from excel (I know the file name and the shape name that i mean to copy everytime), and bringing it back to access to paste on a form? Atypical, I know, all my Access questions are. Thanks!

    Read the article

  • VBA: Difference in two ways of declaring a new object? (Trying to understand why my solution works)

    - by Matt
    I was creating a new object within a loop, and adding that object to a collection; but when I read back the collection after, it was always filled entirely with the last object I had added. I've come up with two ways around this, but I simply do not understand why my initial implementation was wrong. Original: Dim oItem As Variant Dim sOutput As String Dim i As Integer Dim oCollection As New Collection For i = 0 To 10 Dim oMatch As New clsMatch oMatch.setLineNumber i oCollection.Add oMatch Next For Each oItem In oCollection sOutput = sOutput & "[" & oItem.lineNumber & "]" Next MsgBox sOutput This resulted in every lineNumber being 10; I was obviously not creating new objects, but instead using the same one each time through the loop, despite the declaration being inside of the loop. So, I added Set oMatch = Nothing immediately before the Next line, and this fixed the problem, it was now 0 to 10. So if the old object was explicitly destroyed, then it was willing to create a new one? I would have thought the next iteration through the loop would cause anything declared within the loop do be destroyed due to scope? Curious, I tried another way of declaring a new object: Dim oMatch As clsMatch: Set oMatch = New clsMatch. This, too, results in 0 to 10. Can anyone explain to me why the first implementation was wrong?

    Read the article

  • ACCESS/VBA: How to create a ON/OFF type switch to allow record modification on a form ?

    - by Christian M
    I was using a combobox on my search form to select whether to consult or modify a record. To make it more user friendly (IMO), I put a togglebutton on a form, which controls the .AllowEdits property of my form. This way you can easily switch from reading to writing. However I run into a problem; once .AllowEdits is switched to false, the togglebutton is not clickable anymore ! What are my options ?

    Read the article

  • VBA - Prevent Excel 2007 from showing a defined names message box?

    - by John M
    I am working on a Excel 2007 workbook that will contain a macro to save the current sheet (a template) as a PDF file (no problem) a Excel 97-2003 file (problem) When saving the Excel file a messagebox appears asking about "Defined names of formulas in this workbook may display different values when they are recalculated...Do you want Excel to recalculate all formulas when this workbook is opened?". The user can then select Yes/No and then the file will save. How do I disable the messagebox from appearing? The default answer would be 'No'. My code for saving: Sub saveAs_97_2003_Workbook(tempFilePath As String, tempFileName As String) Dim Destwb As Workbook Dim SaveFormat As Long 'Remember the users setting SaveFormat = Application.DefaultSaveFormat 'Set it to the 97-2003 file format Application.DefaultSaveFormat = 56 ActiveSheet.Copy Set Destwb = ActiveWorkbook Destwb.CheckCompatibility = False With Destwb .SaveAs tempFilePath & tempFileName & ".xls", FileFormat:=56 .Close SaveChanges:=False End With 'Set DefaultSaveFormat back to the users setting Application.DefaultSaveFormat = SaveFormat End Sub

    Read the article

  • Excel VBA: select every other cell in a row range to be copied and pasted vertically

    - by terry alexander
    i have a 2200+ page text file. It is delivered from a customer through a data exchange to us with astericks to separate values and tildes (~) to denote the end of a row. The file is sent to me as a text file in Word. Most rows are split in two (1 row covers a full line and part of a second line). i transfer segments (10 page chunks) of it at a time into Excel where, unfortunately, any zeroes that occur at the end of a row get discarded in the "text to columns" procedure. So, i eyeball every "long" row to insure that zeroes were not lost and manually re-enter any that were. Here is a small bit of sample data: SDQ EA 92 1551 378 1601 151 1603 157 1604 83 The "SDQ, EA, and 92" are irrelevant (artifacts of data transmission). i want to use Excel VBA to select 1551, 1601, 1603, and 1604 (these are store numbers) so that i can copy those values and transpose paste them vertically. i will then go back and copy 378, 151, 157, and 83 (sales values) so that i can transpose paste them next to the store numbers. The next two rows of data contain the same store numbers but give the corresponding dollar values. i will only need to copy the dollar values so they can be transpose pasted vertically next to unit values (e.g. 378, 151, 157, and 83). Just being able to put my cursor on the first cell of interest in the row and run a macro to copy every other cell would speed up my work tremendously. i have tried using activecell and offset references to select a range to copy but have not been successful. Does any have any suggestions for me? Thanks in advance for the help.

    Read the article

  • Split Excel worksheet into multiple worksheets based on a column with VBA (Redux)

    - by Ceeder
    I'm rather new to VBA and I've been working with the code generously displayed and explained by Nixda: Split Excel Worksheet... My only challenge is I've been trying desperately to find a way to include the top 3 rows as a title bu it seems to only allow for one. Here's the code have: Dim Titlesheet As Worksheet iCol = 23 '### Define your criteria column strOutputFolder = (Sheets("Operations").Range("D4")) '### <--Define your path of output folder Set ws = ThisWorkbook.ActiveSheet Set rngLast = Columns(iCol).Find("*", Cells(3, iCol), , , xlByColumns, xlPrevious) Set Titlesheet = Sheets("Input") ws.Columns(iCol).AdvancedFilter Action:=xlFilterInPlace, Unique:=True Set rngUnique = Range(Cells(4, iCol), rngLast).SpecialCells(xlCellTypeVisible) If Dir(strOutputFolder, vbDirectory) = vbNullString Then MkDir strOutputFolder For Each strItem In rngUnique If strItem < "" Then Sheets("Input").Select Range("A1:V3").Select Selection.Copy ws.UsedRange.AutoFilter Field:=iCol, Criteria1:=strItem.Value Workbooks.Add Sheets("Sheet1").Select ActiveSheet.PasteSpecial ws.UsedRange.SpecialCells(xlCellTypeVisible).Copy Destination:=[A4] strFilename = strOutputFolder & "\" & strItem ActiveWorkbook.SaveAs Filename:=strFilename, FileFormat:=xlWorkbookNormal ActiveWorkbook.Close savechanges:=False End If Next ws.ShowAllData Is there something I can change to include these lines? Thanks so much, this code provided by Nixda has taught me a great deal!

    Read the article

  • How to Programmatically Split Data Using VBA Using Specific Logic

    - by Charlene
    This is an addition to my previous post here. The code that was previously supplied to me worked like a charm, but I am having issues modifying it adding some additional logic. I am creating a macro in VBA to do the following. I have raw order data that I need to transform based on some logic. Raw Data: order-id product-num date buyer-name prod-name qty-purc sales-tax freight order-st 0000000000-00 10000000000000 5/29/2014 John Doe Product 0 1 1.00 1.50 GA 0000000000-00 10000000000001 5/29/2014 John Doe Product 1 2 1.00 1.50 GA 0000000000-00 10000000000002 5/29/2014 John Doe Product 2 1 1.00 2.00 GA 0000000000-01 10000000000002 5/30/2014 Jane Doe Product 2 1 0.00 0.00 PA 0000000000-01 10000000000003 5/30/2014 Jane Doe Product 3 1 0.00 0.00 PA Desired Outcome: HDR 0000000000-00 John Doe 5/29/2014 CHG Tax 3.00 CHG Freight 5.00 ITM 10000000000000 Product 0 1 ITM 10000000000001 Product 1 2 ITM 10000000000002 Product 2 1 HDR 0000000000-01 Jane Doe 5/30/2014 ITM 10000000000002 Product 2 1 ITM 10000000000003 Product 3 1 The "CHG" rows are created based on the following logic; if the order-st is CA or GA, add the total of sales-tax and freight for each of the rows with the same order-id. If the order-st is NOT CA or GA, no CHG rows should be created. Any help would be appreciated - let me know if I left any details out!

    Read the article

  • Calling oracle stored procedure from Excel - VBA

    - by Ram
    I have to execute an Oracle stored procedure from vba (Excel) with around 38 input parameters. The stored procedure will insert some values in the destination table once that is executed. When it is executed through VBA the number of fields which is inserted is less than when it is executed directly from the backend (oracle). For example it is creating around 17 fields of records while executing directly from the back end. (I have created a wrapper class in the back-end and passing the same parameter values in the back-end.). It is creating around 15 fields of records while executing from the excel VBA in the destination table. Kindly let me know what could be the possible reasons for this.

    Read the article

  • Upload file via HTTP from VBA (WinHTTP)

    - by chiccodoro
    Hi all, I'm trying to HTTP upload a binary file programmatically from within VBA. I intend to put an ASPX page on the server. I know there are lots of nice ways to do that (e.g. use web service instead of aspx), but my constraint is that it must run in VBA (in an excel file), and that I cannot install any additional components on the client. So I guess I'll use WinHTTP, and I've found several examples to post form data, but not to post a binary file. I probably need to base64 the file contents? If so, please let me know. If I can make WinHTTP do file encoding for me, please let me know. If there is a much better way to reach my goal (Upload file from within VBA, server needn't necessarily be ASPX, could be a ASP.NET-Web service as well), please let me know... Thx, chiccodoro

    Read the article

  • Sign a Word VBA project/file via command line or other form of automation

    - by Malcolm
    Is there a way to automate code signing a VBA project in a Word 2003 and/or Word 2007 document? By automate I mean via a command line utility or via Word VBA automation? Motivation: I would like to code sign several Word templates as part of an automated daily build and distribution cycle. Right now we have to do this manually by opening each document in Word and resigning. Thank you, Malcolm

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >