Search Results

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

Page 23/48 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Subscript/Superscript Hotkey for Excel 2010 Macro?

    - by advs89
    Background In Excel 2010, for some ridiculous reason, there is no built-in hotkey (or even a button on the toolbar) for subscripting/superscripting text within a text cell. You can, however, highlight the text, right-click the selection, click format, and then check the [x] subscript or [x] superscript checkbox. Question Are there any kinds of excel macros or workarounds to map two keyboard hotkeys to the subscript and superscript keys, respectively? (It should only be, like, two lines of code - one for the event handler and one for the actual procedure call... I would write one myself but my VBA is rusty, at best, and I am pretty confident there is probably already some kind of solution, despite my inability to find one via search engine) Thanks for any help you can provide!

    Read the article

  • Automatically save attachments from mail on a network drive

    - by user269646
    Every morning I receive an automatically generated e-mail from a server, it includes a spreadsheet attachment. I made a rule in outlook that captures these emails. Now, I would like to make a macro to rename the attached file (. Xls) to =today() and saves it in a folder on a network drive. This macro must run every weekday at 8:00. I've made a lot of VBA in Excel, but have no experience in outlook. Might this be possible? And does anyone know how to do it? Kind regards Staal

    Read the article

  • Excel macro to delete empty rows isn't stopping

    - by RocketGoal
    How do I make it stop after a certain amount of rows? I've taken a VBA course and my teacher explained how to delete empty rows. I'm now trying to put this in place but my macro isn't stopping. I thought I had limited it to 200 rows. I'm missing something important. Any pointers much appreciated. Sub RemoveRows() ' Remove rows from last blank cell Dim LastRow As Long Dim ISEmpty As Long 'Count how many records in the list. This is done so that the Do loop has a finish point. LastRow = Range("A200").End(xlUp).Row 'Start at the top of the list Range("A1").Select 'Loop until the end of the list Do While ActiveCell.Row < LastRow 'Assign number of non empty cells in the row ISEmpty = Application.CountA(ActiveCell.EntireRow) 'If ISEmpty = 0 then delete the row, if not move down a cell into the next row If ISEmpty = 0 Then ActiveCell.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If Loop End Sub

    Read the article

  • How to select all ActiveX objects in an area using a mouse in Excel?

    - by enderland
    Because of this problem with ActiveX objects changing size, I am not grouping my ActiveX objects in my Excel worksheet. Grouping them causes my solution hack to not work which is quite annoying. However, I often times want to be able to essentially use the mouse and select a region and then select all ActiveX objects contained in the region. This would also be useful for easily selecting objects to group them initially. Basically: Use mouse to select area Automatically select all ActiveX components in region I'm fine with a VBA solution if needed. How can I do this?

    Read the article

  • Insert blank row on two conditions

    - by lost_my_wallet_in_el_segundo
    I have a spreadsheet with a large number of rows. There are two rows grouped together (for each customer). In column A, the first row has an account number. The second row should be blank. The spreadsheet has lots of customers listed where there is no second row. I need to insert a blank line to create a second row for each customer that doesn't have one. Here is the VBA script I cobbled together, but it gets a syntax error. Sub Macro1() ' ' Macro1 Macro ' For myrow = 1 To Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row If Cells(myrow, 1) <> "" and Cells(myrow+1, 1) <> "" Then Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove End Sub

    Read the article

  • Java Runtime Exec for VBA script with arguments

    - by Holograham
    I am trying to use Runtime exec() to run a vba script with arguements. I am having trouble passing in the args. I think I need to use the String[] overloaded method for exec. Currently this works: String command = "cmd /c \"\\concat2.vbs\"" Process p = Runtime.getRuntime().exec(command); But I want to run that with arguments and if I do this String command = "cmd /c \"\\concat2.vbs\" " + arg1 + " " + arg2 where arg1 and arg2 are strings my program doesnt run (status = 1)

    Read the article

  • selecting row among duplicated ones in VBA

    - by Elaine Kuo
    ArcGIS 9.3 Arcobject I wanna select one row of each duplicated SIDs in a field below. (an attribute table of a shape file) The priority is R S = I 0 Therefore, among SID 87, FID1 will be selected. (SID 88, STATUS will be S+I) (SID 89, FID 6 will be chosen) Please kindly advise VBA cord to run the selection and thanks. FID SID STATUS 1 87 R 2 87 O 3 88 I 4 88 S 5 89 I 6 89 R 7 89 I 8 89 S

    Read the article

  • Manage spreadsheet versioning

    - by oo
    We have a lot of VBA code in spreadsheets and a lot of time people save them to local drives. When we want to upgrade the spreadsheets we push a new version out to a shared drive but dont have any way of enforcing that people dont use the old versions of the spreadsheets. Is there some best practice here to deploy vba spreadsheets so if someone loads an old version it wont open or will ask you to upgrade. It seems like this must be an issue for any custom solution so i would have through MS would have some solution here. Does microsoft have a standard versioning / deployment solution for this or do i need to come up with some home grown solution (spreadsheet pings a database on startup to check version)

    Read the article

  • Excel found unreadable content in ...

    - by Rashmi Pandit
    Hi, When I open an excel file (generated through VBA code), I get an error "Excel found unreadable content in <filename>. Do you want to recover the contents?" Upon clicking yes, I get a message 'Repairs were made to PivotTable report 'pvtName' on '[filename.xls]Tab'.' The pivot table in question is generated by the VBA code. Is there a way to figure out what repairs are being done on the pivot table, so that I can make the necessary changes in the code before the file is generated? Thanks :)

    Read the article

  • How to Add Icon to a Excel Menu/Toolbar Button

    - by nimo
    Hi, I need to add a image to a custom toolbar/menu item which is create through VBA. For a toolbar item, I tried following code Set NewBtn = TBar.Controls.Add(Type:=msoControlButton) With NewBtn .Picture = LoadPicture("mypic.bmp") .OnAction = "'MyFunction""" & para1 & """'" //VBA Function '.Caption = "MyFunction" .TooltipText = "MyFunction" .Style = msoButtonCaption End With In the above code LoadPicture() does not seem to be working. My toolbar is initializing at the workbook load up event. I noticed that the image is loading to the toolbar button, but in a fraction of second it disappears and only item text is displayed. My image is 16x16 pixel bmp one. Any help appreciate to get around this problem Thank you

    Read the article

  • Auto-fill the current date if the previous row was empty

    - by replax
    I have a spreadsheet sorted by dates. Everyday, I enter new data into it. After each day, I leave one row empty before starting the next day. Example: 20.09.12 XXXXX XXXXX XXXXX XXXX XXXXX XXXX XXXXX XX XX XXXXX XX XXXX 21.09.12 XXX XXXXX XXX XXXX X XXXX XXXX XXX 22.09.12 XXXX XX XXXX XXXX So I want excel to always fill in the current date whenever I enter data after one blank row, but obviously the dates shall stay the same - not be updated to the current date whenever I open excel. I am using Excel 2007 and while non vba ideas are preferred, vba is not a problem either!

    Read the article

  • Problems getting PowerPoint Combobox to list items correctly

    - by mike toyn
    I am creating a PowerPoint in which I want users to be able to select an item from a list in a combo box. Nothing needs to happen after this, it is just to provide a record, on screen, of their choice. My problem is that I seem to either be able to populate the combo box and users can select an item but the list gets longer each time the combobox is clicked on (i.e each time it is clicked on the list gets duplicated). Or alternatively, I can clear the combo box, then populate it but in this scenario, the users choice also seems to get cleared. VBA example 1: Private Sub ComboBox1_DropButtonClick() With ComboBox1 .AddItem " ", 0 .AddItem "speed", 1 .AddItem "provisionality", 2 .AddItem "automation", 3 .AddItem "replication", 4 .AddItem "communicability", 5 .AddItem "multi-modality", 6 .AddItem "non-linearity", 7 .AddItem "capacity", 8 .AddItem "interactivity", 9 End With End Sub VBA example 2: Private Sub ComboBox1_DropButtonClick() ComboBox1.Clear With ComboBox1 .AddItem " ", 0 .AddItem "speed", 1 .AddItem "provisionality", 2 .AddItem "automation", 3 .AddItem "replication", 4 .AddItem "communicability", 5 .AddItem "multi-modality", 6 .AddItem "non-linearity", 7 .AddItem "capacity", 8 .AddItem "interactivity", 9 End With End Sub Can anyone help?

    Read the article

  • Creating An OLEDB Connection From Excel To SQL

    - by Soo
    I am looking to run SQL queries using VBA code in an Excel file. It may sound like a bad way to do things, but the purpose of this is to support legacy functionality on a project I'm working on. I figured out how to create an ODBC connection, but it requires several steps which may be troublesome to implement on many computers, so I'm looking into the possibility of using OLEDB to get the job done. My question is how to go about setting things up so I can run SQL queries in Excel using VBA.

    Read the article

  • SMS connecting to phone from C# and getting response

    - by I__
    here's my VBA code: Public Sub SendSMS() Dim n As Integer n = FreeFile ' Change the string below if using a different COM port or the port speed Open "COM3:9600,N,8,1" For Output As #n Print #n, "AT" Close #n End Sub i'm trying to connect to my phone that is attached to this computer. i need the solution either in VBA or c# and i need to be able to send a receive SMS with my code and get responses from the phone. how do i catch responses to my AT COMMANDS? in hyperterminal you see responses right away, i want to be able to see them here as well, how do i do it? any takers?

    Read the article

  • PowerPoint '10 avoid animation completion on click & advance slide or start new one

    - by ScottS
    Scenario I have PowerPoint 2010 On the "Transitions" tab the "Advance Slide On Mouse Click" check box is checked. I have a long, slow, timed, non-repeating animation working in the background of the slide. I click to advance the slide before the animation is finished, but ... Instead of advancing the slide, the animation moves to the completed state ... Forcing a second click to actually advance the slide. Additionally If I have other animations on the slide that are initiated by a click, the long animation also advances to a finished state before starting the new animation. Desired Behavior On click, I want the slide to advance or the next on-click animation to start whether the long animation is done or not, and without having that long animation first "complete" itself. In the case of another animation, I simply want the long animation to continue, while also doing the new animation. Ultimate Question Is there a way to either: Set an option somewhere to not have that animation complete on click and simply "continue" to animate with the start of a new animation or to advance the slide (as the case may be)? Create a VBA script that will produce the desired behavior for the long animation?

    Read the article

  • Random Sampling in Excel

    - by bonsvr
    I have an Excel sheet as follows: NO NAME AMOUNT 1 A 50 1 B 50 2 A 100 2 C 100 3 D 70 3 B 70 4 A 30 4 F 30 5 C 150 5 G 150 . . . . There are let's say 10,000 rows. I want to get a random sample from rows. There are 2 conditions: 1. Sampling must be based on "NO" column. 2. Size of the sample is determined by the user: it can be %5, %10 or %20. For example, one decides to randomly choose %20 of total rows in the above example: The result is like: NO NAME AMOUNT 2 A 100 2 C 100 90 Z 500 90 E 500 . . . . There should be 2,000 rows. I don't know whether my question is too specific. I am new to Excel VBA, and I faced a situation like this. Above process is about getting a random sample from an account ledger for auditing purposes.

    Read the article

  • Pasting formatted Excel range into Outlook message

    - by Steph
    Hi everyone, I am using Office 2007 and I would like to use VBA to paste a range of formatted Excel cells into an Outlook message and then mail the message. In the following code (that I lifted from various sources), it runs without error and then sends an empty message... the paste does not work. Can anyone see the problem and better yet, help with a solution? Thanks, -Steph Sub SendMessage(SubjectText As String, Importance As OlImportance) Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment Dim iAddr As Integer, Col As Integer, SendLink As Boolean 'Dim Doc As Word.Document, wdRn As Word.Range Dim Doc As Object, wdRn As Object ' Create the Outlook session. Set objOutlook = CreateObject("Outlook.Application") ' Create the message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem) Set Doc = objOutlookMsg.GetInspector.WordEditor 'Set Doc = objOutlookMsg.ActiveInspector.WordEditor Set wdRn = Doc.Range wdRn.Paste Set objOutlookRecip = objOutlookMsg.Recipients.Add("[email protected]") objOutlookRecip.Type = 1 objOutlookMsg.Subject = SubjectText objOutlookMsg.Importance = Importance With objOutlookMsg For Each objOutlookRecip In .Recipients objOutlookRecip.Resolve ' Set the Subject, Body, and Importance of the message. '.Subject = "Coverage Requests" 'objDrafts.GetFromClipboard Next .Send End With Set objOutlookMsg = Nothing Set objOutlook = Nothing End Sub

    Read the article

  • PowerPoint avoid animation completion on click & advance slide or start new one

    - by ScottS
    Scenario I have PowerPoint 2010 On the "Transitions" tab the "Advance Slide On Mouse Click" check box is checked. I have a long, slow, timed, non-repeating animation working in the background of the slide. I click to advance the slide before the animation is finished, but ... Instead of advancing the slide, the animation moves to the completed state ... Forcing a second click to actually advance the slide. Additionally If I have other animations on the slide that are initiated by a click, the long animation also advances to a finished state before starting the new animation. Desired Behavior On click, I want the slide to advance or the next on-click animation to start whether the long animation is done or not, and without having that long animation first "complete" itself. In the case of another animation, I simply want the long animation to continue, while also doing the new animation. Ultimate Question Is there a way to either: Set an option somewhere to not have that animation complete on click and simply "continue" to animate with the start of a new animation or to advance the slide (as the case may be)? Create a VBA script that will produce the desired behavior for the long animation?

    Read the article

  • Pivot table not refreshing sort order

    - by William Anthony
    I have Pivot Table that get its data source from another sheet, same workbook. I want the sort order of data is same as the data source order, I choose "Sort in data source order" in Pivot Table option. The problem is, when I change the data order on data source worksheet, then I refresh the Pivot Table, the sort order didn't change. I googled that the Pivot Table should be unlink first then re-link again in order to work properly, so I tried the following: The original data source has named range: origdata. The fake data source has names range: dummydata I changed manually data source to dummydata then changed back to origdata. The sort order did change as expected. Now I want to make the operation automated, so I'm using this code in Worksheet.activate event. Note that, PT is PivotTable instance. ... PT.SourceData = "dummydata" PT.RefreshTable PT.SourceData = "origdata" PT.RefreshTable ... Change data source from VBA didn't change the sort order just like I did with manual method. Why is that? Am I missing something? Maybe there are some routine called when I changed the data source manually via toolbar button? Thanks in advance for your help.

    Read the article

  • Getting Run time 1004 error in code

    - by krishna123
    I tried the code provided by vba express for combining sheet, while execution it is displaying Run Time error 1004: Application Defined or Object Defined Error: My Scenario is: I have a Excel, in that I have first sheet "Connection" and after it I have Sheet1, Sheet2 and so on. I am combining all sheets except Sheet"Conection" by saying start with sheet2. I tried following line of code to exclude "Connection" sheet: If Not Sheet.Name = "Connection" then but it did not work. Whatever the sheets I have in some of them I have large data in some cells. Here is the code which I am using: I have highlighted the line Sub CopyFromWorksheets() Dim wrk As Workbook 'Workbook object - Always good to work with object variables Dim sht As Worksheet 'Object for handling worksheets in loop Dim trg As Worksheet 'Master Worksheet Dim rng As Range 'Range object Dim colCount As Integer 'Column count in tables in the worksheets Set wrk = ActiveWorkbook 'Working in active workbook For Each sht In wrk.Worksheets If sht.Name = "Master" Then sht.Delete Exit Sub End If Next sht 'We don't want screen updating Application.ScreenUpdating = False 'trg.SaveAs "C:\temp\CPReport1.xls" 'Add new worksheet as the last worksheet Set trg = wrk.Worksheets.Add(After:=wrk.Worksheets(wrk.Worksheets.Count)) 'Rename the new worksheet trg.Name = "Master" 'Get column headers from the first worksheet 'Column count first Set sht = wrk.Worksheets(2) colCount = sht.Cells(1, 255).End(xlToLeft).Column 'Now retrieve headers, no copy&paste needed With trg.Cells(1, 1).Resize(1, colCount) .Value = sht.Cells(1, 1).Resize(1, colCount).Value 'Set font as bold .Font.Bold = True End With trg.SaveAs "C:\temp\CPReport1.xls" 'We can start loop 'Skip Sheet - Connection If Not sht.Name = "Connection" Then For Each sht In wrk.Worksheets 'If worksheet in loop is the last one, stop execution (it is Master worksheet) If sht.Index = wrk.Worksheets.Count Then Exit For End If 'Data range in worksheet - starts from second row as first rows are the header rows in all worksheets Set rng = sht.Range(sht.Cells(2, 1), sht.Cells(65536, 1).End(xlUp).Resize(, colCount)) 'Put data into the Master worksheet '----------------- Error in below line -------------------------------------------------- trg.Cells(65536, 1).End(xlUp).Offset(1).Resize(rng.Rows.Count, rng.Columns.Count).Value = rng.Value '---------------------------------------------------------------------------------------- Next sht End If 'Fit the columns in Master worksheet trg.Columns.AutoFit 'Dim dest, destyfile 'dest = "E:\Test_Merge\" 'destyfile = dest & "_" & trg.Name 'trg.SaveAs (destyfile) 'Screen updating should be activated Application.ScreenUpdating = True End Sub

    Read the article

  • Moving to the next line to populate an excel file from VBA

    - by edmon
    I have the below code that takes certain fields from my MS Access (A small Hotel Reservation Database)form and populates defined cells in the said Excel file. Dim objXLApp As Object Dim objXLBook As Object Set objXLApp = CreateObject("Excel.Application") Set objXLBook = objXLApp.Workbooks.Open("Y:\123files\File\Hotel Reservation.xls") objXLApp.Application.Visible = True objXLBook.ActiveSheet.Range("B2") = Me.GuestFirstName & " " & GuestLastName objXLBook.ActiveSheet.Range("C2") = Me.PhoneNumber objXLBook.ActiveSheet.Range("E2") = Me.cboCheckInDate objXLBook.ActiveSheet.Range("F2") = Me.cboCheckOutDate objXLBook.ActiveSheet.Range("H2") = Me.RoomType objXLBook.ActiveSheet.Range("I2") = Me.RoomNumber End Sub How can I keep populating a new Guest to the same Excel file just on the next row?

    Read the article

  • Copy data from different worksheet to a master worksheet but no duplicates

    - by sam
    hi all, i want to clarify my initial question for a possible solutions from any savior out there. Say i have 3 excel sheets one for each user for data entry located in separate workbooks to avoid excel share workbook problems. I also have a master sheet in another workbook where i want individual data enter on those sheets precisely sheets 1 should copy to the next available row of sheet 1 in the master sheet as the users enter them. i need a vba code that can copy each record without copying a duplicate row in the master sheet but highlight the duplicate row and lookup the initial record in a master sheet and return the name of the Imputer looking up the row say column ( I) where each user sign there initials after every row of entry like below. All 4 worksheets are formatted as below: lastname account cardno. type tran amount date location comments initials JAME 65478923 1975 cash 500 4/10/2010 miles st. this acct is resolve MLK BEN 52436745 1880 CHECK 400 4/12/2010 CAREY ST Ongoing investigation MLK JAME 65478923 1975 cash 500 4/10/2010 miles st. this acct is resolve MLK I need the vba to recognize duplicates only if the account number and the card number matches the initial records. So if the duplicates exist a pop up message should be display that a duplicates exist and return the initial Imputer say MLK in COLUMN( I) to any user inputting in the individual worksheets other than warehouse sheets (master). So please any idea will be appreciated.

    Read the article

  • Excel COM Add-In dialog interrupts script

    - by usac
    Hi all! I have written an Excel COM Add-In in C++ for automation of Excel with VBA. It contains an own dialog showing some general informations about the Add-In. Now i create a button in Excel that opens the dialog. Leaving the dialog with the escape key leads to an Excel message that the script is being interrupted instead of just closing the dialog. I could suppress the interruption message with: Application.EnableCancelKey = xlDisabled But that seems not to be the solution as the script can not be interrupted any more. Here is an example how i use VBA to open the dialog: Private Sub ShowAboutDialog_Click() Dim oComAddIn As COMAddIn Set oComAddIn = Application.COMAddIns.Item("MyComAddIn.Example") oComAddIn.Connect = True Call oComAddIn.Object.ShowAboutDlg End Sub My guess is that the problem is somewhere in the message handler of the dialog: INT_PTR CALLBACK CAboutDialog::AboutDlg( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { ... case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { // Here, the ESCAPE key should also be trapped? EndDialog(hwndDlg, LOWORD(wParam)); return TRUE; } ... } return FALSE; } The Dialog is created with: DialogBox(g_hModule, MAKEINTRESOURCE(IDD_ABOUT), hWndParent, (DLGPROC)AboutDlg) Thanks a lot!

    Read the article

  • Access ADP - For/Against?

    - by webworm
    I have been tasked with taking an Access 97 application and moving the back-end data to SQL Server while moving the front end to Access 2003 (using Access Data Projects). In the process of this migration the back-end data structures will be changed significantly to support new functionality. If I had my wish we would not be using Access as the front end. I think our application would be much better served by WinForms, WPF, or a web application. We have the time needed to properly plan a business logic layer and implement an excellent solution but powers above me want to stay with Access because that is what they are familiar with. What I could use help with is pros/cons of continuing down this path of Access development. What are some legitimate arguments for and against using Access 2003? Here is what I have come up with so far. Pro Access: Already own Access 2003 licenses Easy GUI development Reports look nice Against Access Having to use VBA (Visual Basic for Applications) ADO vs DAO. Didn't Microsoft change things from Access 2002 to Access 2003? Not tied to Access runtime Choice in front end (WPF, WinForms, even ASP.NET) Maintainability True separation of logic from UI not possible Does Microsoft still support Access ADP? Perhaps there are other issues I am not aware off both for and against Access for application development. I am trying to keep an open mind while at the same time trying to maintain my sanity. I have been using C# since .NET was released and the thought of going back to VBA for six months makes my head hurt. Especially when I feel I could offer so much more if allowed to develop with modern languages and tools?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >