Search Results

Search found 3613 results on 145 pages for 'outlook vba'.

Page 39/145 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • How to fill many texbox by using loop function in VBA

    - by melt
    Hi ! I made a user interface in VBA with many textbox. I read an excel sheet and I put all the value of this one in all the textbox of my user inteface. So the user can modify the values and then save it in the excel sheet. Because we can't name the textbox like array (textBox(1), textbox(2)....) this is hard to fill the textbox by using a loop function. I tried to use tag or tabindex property but I don't find the good way to proceed .... Is someone know an easy way to solve this !!! Thanks

    Read the article

  • Outlook Mobile Service Configuration Issue

    - by cbeckner
    I am working on writing a OMS implementation. I have verified that service is compliant with the service and schema definitions. When trying to set up the account in Outlook 2007 to test the service, it allows me to use an https address, but not an http address. According to the documentation (http://msdn.microsoft.com/en-us/library/bb277363.aspx) "The URL of the OMS Web service can be either http or https, but it is https if not otherwise specified" I have not been able to find any doucmentation that would explain why Outlook will not even let me try to do anything in the wizard if the service url does not start with https. The error that it returns when a http address is entered is: The web service address is incorrect or corrupted. Check the web service address or contact your administrator I have also tried creating a temporary cert on my local machine to test the service, but outlook is rejecting the cert because it is not valid. Is there any way to test the service or run it over http?

    Read the article

  • Transponse the data from vertical to horizondal using vba

    - by raam
    I wants to popualte the data in MS-Access into Excel for this i am using VBA This is my code varConnection = "ODBC; DSN=MS Access Database;DBQ=D:\sample\table.accdb; Driver={Driver do Microsoft Access (*.accdb)}" varSQL = "SELECT * FROM LeftPanes" With ActiveSheet.QueryTables.Add(Connection:=varConnection, Destination:=ActiveSheet.Range("B4")) .CommandText = varSQL .Name = "Query-39008" .Refresh BackgroundQuery:=False End With Its working Properly it retrive data and display in the correct sheet my problem is that this code display the retrived date in vertically view i needs horizondal view. it is possible to display in horizondal view please any one guide me . Thanks in advance

    Read the article

  • Stored procedure does not return data if executed from VBA

    - by Sam
    I had stored procedure MySPOld in Sybase db. I created new sp MySP. This new sp returns data while executed from Sybase Sql Advantage. But not returning the data when called from VBA - Excel 2003 (EOF property of recordset is True). Here is my code.. Dim dbCon As ADODB.Connection Dim rstTemp As New ADODB.Recordset Dim query As String query = "exec MySP '01/01/2010', '01/14/2010'" dbCon.Open connectionString, "username" "password" dbCon.CommandTimeout = 300 rstTemp.Open query, dbCon, adOpenForwardOnly The code was working well with old sp. What could be the problem ? any idea ? Thanks in Advance.

    Read the article

  • Get the content of a sharepoint folder with Excel VBA

    - by Blackethylene
    Usually I use this piece of code to retrieve the content of a folder in VBA. But this doesn't work in the case of a sharepoint. How can I do ? Dim folder As folder Dim f As File Dim fs As New FileSystemObject Set folder = fs.GetFolder("//sharepoint.address/path/to/folder") For Each f In folder.Files 'Do something Next f EDIT (after a good comment by shahkalpesh) : I can access to the sharepoint if I enter the address in Windows Explorer. Access to the sharepoint needs an authentification, but it's transparent, because it relies on the Windows login.

    Read the article

  • Setting Global Variables in VBA

    - by dennis96411
    I'm currently making an "OS" in PowerPoint and I need to know how to set global variables for the settings. I made a module called "Settings" containing: Public Sub Settings() Option Explicit Public UserName, UserIcon, Background, BrowserHomePage As String Public SetupComplete As Boolean SetupComplete = False UserName = "Administrator" UserIcon = Nothing Background = Nothing BrowserHomePage = Nothing 'Set the variables UserName.Text = UserName End Sub Now on the "log in" screen, I have a text box named "UserName". I then made a button just to test out the variables. The button does this: Private Sub CommandButton1_Click() UserName.Value = UserName End Sub The text box has no value when I click the button. I'm super new at VBA, and would like to know how to do this. Also, if anyone knows how to automatically execute codes when starting the PowerPoint, that would be fantastic.

    Read the article

  • VBA for filtering columns

    - by Ampi Severe
    I have a big database-like sheet, first row contains headers. I would like a subset of rows of this table based on column values. Two issues: 1) VBA-wise I would like to loop through the columns, when the values for all necessary columns all match, copy the entire row into a new sheet. 2) The subset of rows is based on a list. This should be the first column to be looped through. For example I want all rows where the value in column A is equal to one of the values in my list. Is there any possibility to autofilter strings based on a list (column) of strings? EDIT Thanks to @Doug Glancy the autofiltering works now, so I've removed my (horrible) code and issue 1 is solved.

    Read the article

  • Passing parameters in VBA for Access

    - by Newbie
    In Access 2007 I have created a form with a textbox and a button. At the moment, when I press the button, I load a query with the textbox data passed as a parameter to the query criteria. I would like to change this so that all (manually input) options appear in a combobox (in place of the textbox). I would then like to pass the combobox text to a VBA module upon pressing the button. How do I do this? Similarly, I hope to output a different string from this module, and I hope to use this as the query criteria. How do I do this?

    Read the article

  • Upload a .pdf file to a Sharepoint Document Library using Access vba

    - by Jim Shaffer
    Within an Access 2007 application, I'm creating a static report in .pdf format. I want to create it, then export the static report (not the data itself) to a Sharepoint Document Library. The intent is for it to be a public repository, no versioning. Each report will carry a unique name. I'm a seasoned vba programmer, but using Sharepoint services is new to me. How do I go about doing this? Assume I can identify the file name and location after I've generated it, and I know the Sharepoint library URL, and have permissions. Where do I go from there?

    Read the article

  • Need a Concatenating VBA code to prevent memory issue workaround

    - by doharr
    My set up: Have 50,000 rows of data. ( My row count will increase in the future. So might as well say I have a full worksheet of 64000+ rows.) All Data is TEXT, no formulas, etc. Column A is open Columns B thru AC contain the Data that needs to be concatenated The Data in the rows once concatenated to Column A will contain 60,000 digits or 6kb in file size. After additional maniuplation each cell will become a file. I have tried concatenating in Excel and I run into memory issues. The memory issue is when I Select and fill down the concatenating function into the worksheet. It crashes at the 8200 +/-row. My system is 2gb of ram, windows xp professional and Excel 2003. Have 4GB of disk space Hoping to find a VBA code that will conserve memory, and not crash like it does in excel. Thank you

    Read the article

  • outlook calendar connectivity with java web service

    - by Isisagate
    We currently have a java/jsp online web service that includes it's own custom calendar. I am trying to do some research into the possibility of connecting it to a users outlook. Our basic needs that are most simple is some way to sent the person a meeting request that can be added to their outlook from our service. I know the ideal solution is to sync back and forth but simply being able to import the data from our calendar into someone's outlook would be sufficient. Does anyone have any resources they can point me to that might help with information gathering, or any example/comments?

    Read the article

  • Beginner Access VBA SQL INSERT Question

    - by Josh K
    Syntax question: I am using the code below to call a query in Access VBA strSQL = "INSERT INTO tblLoanDetails ([ServerName]) VALUES ('Test') WHERE [ID]=3" Call CurrentDb.Execute(strSQL) And i am getting a runtime error of "3067: Query must contain atleast one table or query." the insert statement string looks like this (Threw the var into a text box): INSERT INTO tblLoanDetails ([ServerName]) VALUES ('Test') WHERE [ID]=3 I also tried adding a semi-colon to the end but with no luck. I also double checked to make sure my table is called tblLoanDetails and my Column names are ServerName, and ID Appreciate any help.

    Read the article

  • c# converting select case VBA to c# SWITCH

    - by herrow
    i have some vba code that i need to convert to c# Select Case letter0 Case "A01" Cells(rownum, 2).Value = "1" Case "B01" Cells(rownum, 2).Value = "2" Case "C01" Cells(rownum, 2).Value = "3" Case "D01" Cells(rownum, 2).Value = "4" Case "E01" Cells(rownum, 2).Value = "5" Case "F01" Cells(rownum, 2).Value = "6" Case "G01" Cells(rownum, 2).Value = "7" Case "H01" Cells(rownum, 2).Value = "8" Case "A02" Cells(rownum, 2).Value = "9" Case "B02" ... .. i understand how to do a switch on this, but is there an easier method? i will not be checking CELLS(rownum.........) instead of will be doing switch(somestring) is there an easier way to do this than explicitly write every single case?

    Read the article

  • Windows Service SearchIndexer.exe Crashes on Indexing

    - by Josh Jay
    Relevant Specs: Windows 7 Professional 64-bit SP1 Outlook 2010 Version 14.0.7116.5000 (32-bit) Original Symptom: In outlook, I attempted to search for an email but nothing ever returned and the indicator kept going like it was searching. Attempted Resolutions: I investigated the search options and with some research noticed the Windows Service "Windows Search" (SearchIndexer.exe) was not running. I attempted to start it but I receive this error message: "Windows could not start the Windows Search service on Local Computer. Error 1067: The process terminated unexpectedly." The Event Viewer gives this error entry: Log Name: Application Source: Application Error Date: 6/3/2014 11:02:05 AM Event ID: 1000 Task Category: (100) Level: Error Keywords: Classic User: N/A Computer: ***REMOVED FOR POST*** Description: Faulting application name: SearchIndexer.exe, version: 7.0.7601.17610, time stamp: 0x4dc0d019 Faulting module name: KERNELBASE.dll, version: 6.1.7601.18229, time stamp: 0x51fb1677 Exception code: 0xc0000005 Fault offset: 0x000000000000940d Faulting process id: 0x6a0 Faulting application start time: 0x01cf7f3cc83757c6 Faulting application path: C:\Windows\system32\SearchIndexer.exe Faulting module path: C:\Windows\system32\KERNELBASE.dll Report Id: 06424160-eb30-11e3-9555-843a4b07b336 Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Application Error" /> <EventID Qualifiers="0">1000</EventID> <Level>2</Level> <Task>100</Task> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2014-06-03T15:02:05.000000000Z" /> <EventRecordID>602923</EventRecordID> <Channel>Application</Channel> <Computer>M6700-12011.ncaa.org</Computer> <Security /> </System> <EventData> <Data>SearchIndexer.exe</Data> <Data>7.0.7601.17610</Data> <Data>4dc0d019</Data> <Data>KERNELBASE.dll</Data> <Data>6.1.7601.18229</Data> <Data>51fb1677</Data> <Data>c0000005</Data> <Data>000000000000940d</Data> <Data>6a0</Data> <Data>01cf7f3cc83757c6</Data> <Data>C:\Windows\system32\SearchIndexer.exe</Data> <Data>C:\Windows\system32\KERNELBASE.dll</Data> <Data>06424160-eb30-11e3-9555-843a4b07b336</Data> </EventData> </Event> The regular windows search (from start menu) works fine, and if I reboot the machine the service starts up OK but as soon as it kicks off when I let the machine idle for long enough it crashes (same Event Viewer entry). We also tried the Microsoft Utility to no avail. Has anyone seen this issue before?

    Read the article

  • Ask How-To Geek: Fixing the Windows Boot Record, Sharing Mac Folders with Windows, and Reviving the Outlook Reminder Bell

    - by Jason Fitzpatrick
    You’ve got questions and we’ve got answers. Today we look at how to boot into Windows after uninstalling Linux, sharing folders between a Mac and a Windows computer, and how to reinstate the missing Outlook reminder bell. Once a week we dip into our mailbag and help readers solve their problems, sharing the useful solutions with you I the process. Read on to see our fixes for this week’s reader dilemmas.How To Make a Youtube Video Into an Animated GIFHTG Explains: What Are Character Encodings and How Do They Differ?How To Make Disposable Sleeves for Your In-Ear Monitors

    Read the article

  • How to Add a Business Card Image to a Signature in Outlook 2013 Without the vCard (.vcf) File

    - by Lori Kaufman
    When you add a business card to a signature, an image of the business card is inserted into the signature and the vCard (.vcf) file is attached. If you don’t want to attach the vCard file, you can insert the image only into your signature. To insert only the image of your business card without the .vcf file, click People on the Navigation Bar at the bottom of the Outlook window. To get a business card image we can use, we must view the contacts in any form other than People, so we can open the full contact editing window. To do this, click on a different view in the Current View section of the Home tab. We chose to view our contacts in the Business Card format. Double-click on your contact in the current view. The full contact editing window displays with an image of the business card on the right. Right-click on the business card image and select Copy Image from the popup menu. To close the contact editing window, click the File tab and click Close in the menu list on the left. NOTE: You can also click the X in the upper, right corner of the contact editing window to close it. To open the signature editor, click the File tab. Click Options in the menu list on the left side of the Account Information screen. On the Outlook Options dialog box, click Mail in the list of options on the left side of the dialog box. On the Mail screen, click Signatures in the Compose messages section. NOTE: You can also access the Signatures and Stationery dialog box from the Message window for new emails and drafts. Click New Email on the Home tab or double-click an email in the Drafts folder to access the Message window. For more information, see our article about assigning a default signature. In the signature editor, right-click and select Paste from the popup menu. The image is inserted into the signature. You can also use this method to copy a business card image for use in other documents and programs. It’s also possible to insert the vCard (.vcf) file into a signature without the image. We’ll cover that topic tomorrow.     

    Read the article

  • How do you optimize your Outlook Exchange + IMAP setup?

    - by Mike
    My company provides an Outlook/Exchange account we must use for mail/calendar. Like many companies, they unfortunately also provide a ridiculously small mail quota. I got tired of managing and backing up .pst files (since I'm always in my e-mail there is never a good time to back it up), so I started storing my archived mail "in the cloud", using an IMAP server I set up on my Linux box. This has a few drawbacks for me: IMAP (at least the implementation in Outlook) is *very slow*. Furthermore, if I move a large number of messages to the IMAP server, it blocks the entire Outlook client for hours sometimes, which is quite annoying. Can't use exchange over HTTP to do mail without launching a VPN session, because the client-side rules I have which organize my mail fail and disable the rule if the IMAP server can't be reached. If I reply to a message from my IMAP store, I have to specify a SMTP server willing to relay for me in order to send e-mail, unless I always remember to select my Exchange account while composing e-mail. ... but the main advantage of being very easy to back up, with a couple of cron jobs that essentially do an 'rsync'. Short of moving the IMAP server to my local host (which seem like might have the same file locking problems as using a .pst), my options seem limited for solving (1). I'd like to come up with a solution for (2) and (3) though. For problem (2) would it be possible to somehow tell Outlook that the IMAP server is "offline", and have it synchronize my changes during a periodic "send and receive"? If so, I wonder if it would block the Outlook client, like it does in problem (1), and if it would be compatible with the client-only rules I use to sort my mail into folders. I've looked all over the options menu and have not found a way to tell Outlook to not use a certain account for sending mail, which would solve (3). Is anyone else crazy enough to be doing something like this? Any ideas?

    Read the article

  • A Web exception occurred because an HTTP 503 - ServiceUnavailable response was received from Unknown

    - by Dai
    As far as I can tell my Exchange 2010 Mailbox and Client Access server is working fine except for Outlook Anywhere. I fired up the Exchange Connectivity Tester and ran it against my server and I get this report: Part 5 Testing HTTP Authentication Methods for URL https://mail.contoso.com/rpc/rpcproxy.dll?server6.corp.contoso.com:6002. The HTTP authentication test failed. Additional details: A Web exception occurred because an HTTP 503 - ServiceUnavailable response was received from Unknown. When I do a search for "ServiceUnavailable response was received from Unknown." I get only a couple of relevant results, including a 22k-view Exchange Forum thread, but none of the solutions discussed help. There is nothing of relevance in the server's Event Log. mail.contoso.com is the public domain name of the CAS/MB/HT server. server6.corp.contoso.com is the internal domain name of the server.

    Read the article

  • Automation Error upon running VBA script in Excel

    - by brohjoe
    Hi guys, I'm getting an Automation error upon running VBA code in Excel 2007. I'm attempting to connect to a remote SQL Server DB and load data to from Excel to SQL Server. The error I get is, "Run-time error '-2147217843(80040e4d)': Automation error". I checked out the MSDN site and it suggested that this may be due to a bug associated with the sqloledb provider and one way to mitigate this is to use ODBC. Well I changed the connection string to reflect ODBC provider and associated parameters and I'm still getting the same error. Here is the code with ODBC as the provider: Dim cnt As ADODB.Connection Dim rst As ADODB.Recordset Dim stSQL As String Dim wbBook As Workbook Dim wsSheet As Worksheet Dim rnStart As Range Public Sub loadData() 'This was set up using Microsoft ActiveX Data Components version 6.0. 'Create ADODB connection object, open connection and construct the connection string object. Set cnt = New ADODB.Connection cnt.ConnectionString = _ "Driver={SQL Server}; Server=onlineSQLServer2010.foo.com; Database=fooDB Uid=logonalready;Pwd='helpmeOB1';" cnt.Open On Error GoTo ErrorHandler 'Open Excel and run query to export data to SQL Server. strSQL = "SELECT * INTO SalesOrders FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0', & _ "'Data Source=C:\Database.xlsx; Extended Properties=Excel 12.0')...[SalesOrders$]" cnt.Execute (strSQL) 'Error handling. ErrorExit: 'Reclaim memory from the connection objects Set rst = Nothing Set cnt = Nothing Exit Sub ErrorHandler: MsgBox Err.Description, vbCritical Resume ErrorExit 'clean up and reclaim memory resources. cnt.Close If CBool(cnt.State And adStateOpen) Then Set rst = Nothing Set cnt = Nothing End If End Sub

    Read the article

  • Excel VBA Select Case Loop Sub

    - by Zack
    In my excel file, I have a table setup with formulas. with Cells from Range("B2:B12"), Range ("D2:D12"), and etc every other row containing the answers to these formulas. for these cells (with the formula answers), I need to apply conditional formatting, but I have 7 conditions, so I've been using "select case" in VBA to change their interior background based on their number. I have the select case function currently set up within the sheet code, as opposed to it's own macro Private Sub Worksheet_Change(ByVal Target As Range) Dim iColor As Integer If Not Intersect(Target, Range("B2:L12")) Is Nothing Then Select Case Target Case 0 iColor = 2 Case 0.01 To 0.49 iColor = 36 Case 0.5 To 0.99 iColor = 6 Case 1 To 1.99 iColor = 44 Case 2 To 2.49 iColor = 45 Case 2.5 To 2.99 iColor = 46 Case 3 To 5 iColor = 3 End Select Target.Interior.ColorIndex = iColor End If End Sub but using this method, you must be actually entering the value into the cell for the formatting to work. which is why I want to write a subroutine to to do this as a macro. I can input my data, let the formulas work, and when everything is ready, I can run the macro and format those specific cells. I want an easy way to do this, obviously I could waste a load of time, typing out all the cases for every cell, but I figured it'd be easier with a loop. how would I go about writing a select case loop to change the formatting on a a specific range of cells every other row? thank you in advance.

    Read the article

  • Excel VBA SQL Import

    - by user307655
    Hi All, I have the following code which imports data from a spreadsheet to SQL directly from Excel VBA. The code works great. However I am wondering if somebody can help me modify the code to: 1) Check if data from column A already exists in the SQL Table 2) If exists, then only update rather than import as a new role 3) if does not exist then import as a new role. Thanks again for your help Sub SQLIM() ' Send data to SQL Server ' This code loads data from an Excel Worksheet to an SQL Server Table ' Data should start in column A and should be in the same order as the server table ' Autonumber fields should NOT be included' ' FOR THIS CODE TO WORK ' In VBE you need to go Tools References and check Microsoft Active X Data Objects 2.x library Dim Cn As ADODB.Connection Dim ServerName As String Dim DatabaseName As String Dim TableName As String Dim UserID As String Dim Password As String Dim rs As ADODB.Recordset Dim RowCounter As Long Dim ColCounter As Integer Dim NoOfFields As Integer Dim StartRow As Long Dim EndRow As Long Dim shtSheetToWork As Worksheet Set shtSheetToWork = ActiveWorkbook.Worksheets("Sheet1") Set rs = New ADODB.Recordset ServerName = "WIN764X\sqlexpress" ' Enter your server name here DatabaseName = "two28it" ' Enter your database name here TableName = "COS" ' Enter your Table name here UserID = "" ' Enter your user ID here ' (Leave ID and Password blank if using windows Authentification") Password = "" ' Enter your password here NoOfFields = 7 ' Enter number of fields to update (eg. columns in your worksheet) StartRow = 2 ' Enter row in sheet to start reading records EndRow = shtSheetToWork.Cells(Rows.Count, 1).End(xlUp).Row ' Enter row of last record in sheet ' CHANGES ' Dim shtSheetToWork As Worksheet ' Set shtSheetToWork = ActiveWorkbook.Worksheets("Sheet1") '** Set Cn = New ADODB.Connection Cn.Open "Driver={SQL Server};Server=" & ServerName & ";Database=" & DatabaseName & _ ";Uid=" & UserID & ";Pwd=" & Password & ";" rs.Open TableName, Cn, adOpenKeyset, adLockOptimistic For RowCounter = StartRow To EndRow rs.AddNew For ColCounter = 1 To NoOfFields rs(ColCounter - 1) = shtSheetToWork.Cells(RowCounter, ColCounter) Next ColCounter Next RowCounter rs.UpdateBatch ' Tidy up rs.Close Set rs = Nothing Cn.Close Set Cn = Nothing End Sub

    Read the article

  • excel vba to CRUD drupal nodes

    - by Kirk Hings
    We need to periodically migrate Excel reports data into Drupal nodes. We looked at replicating some Excel functionality in Drupal with slickgrid, but it wasn't up to snuff. The Excel reports people don't want to double-enter their data, but their data is important to be in this Drupal site. They have hundreds of Excel reports, and update a row in each weekly. We want a button at the row end to fire a VBA macro that submits the data to Drupal, where a new node is created from the info submitted. (Yes, we are experienced with both Drupal and VBA; all users and the site are behind our firewall.) We need the new node's nid or URL returned so we can then create a link in Excel directly to that node Site is D6, using Services 3.x module. I tried the REST server module, but we can't get it to retrieve data without session authentication on, which we can't do from Excel. (unless you can?) I also noticed the 'data' it was returning via browser url was 14 or 20 nodes' info, not the one nid requested (Example: http://mysite.com/services/rest/report/node/30161) When I attempt to create a simple node like this from VBA: Dim MyURL as String MyURL = "http://mysite.com/services/rest/report/node?node[type]=test&node[title]=testing123&node[field_test_one][0][value]=123" Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") With objHTTP .Open "POST", MyURL, False .setRequestHeader "Content-Type", "application/x-www-form-urlencoded" .send (MyURL) End With I get HTTP Status: Unauthorized: Access denied for user 0 "anonymous" and HTTP Response: null Everything I search for has examples in php or java, nothing in VBA. Also tried switching to using an XMLRPC server but that's even more confusing. We would like json (used application/json, set formatter accordingly in REST server settings), but will use anything that works. Ideas? Thanks in advance!

    Read the article

  • Looping through recordset with VBA

    - by Robert
    I am trying to assign salespeople (rsSalespeople) to customers (rsCustomers) in a round-robin fashion in the following manner: Navigate to first Customer, assign the first SalesPerson to the Customer. Move to Next Customer. If rsSalesPersons is not at EOF, move to Next SalesPerson; if rsSalesPersons is at EOF, MoveFirst to loop back to the first SalesPerson. Assign this (current) SalesPerson to the (current) Customer. Repeat step 2 until rsCustomers is at EOF (EOF = True, i.e. End-Of-Recordset). It's been awhile since I dealt with VBA, so I'm a bit rusty, but here is what I have come up with, so far: Private Sub Command31_Click() 'On Error GoTo ErrHandler Dim intCustomer As Integer Dim intSalesperson As Integer Dim rsCustomers As DAO.Recordset Dim rsSalespeople As DAO.Recordset Dim strSQL As String strSQL = "SELECT CustomerID, SalespersonID FROM Customers WHERE SalespersonID Is Null" Set rsCustomers = CurrentDb.OpenRecordset(strSQL) strSQL = "SELECT SalespersonID FROM Salespeople" Set rsSalespeople = CurrentDb.OpenRecordset(strSQL) rsCustomers.MoveFirst rsSalespeople.MoveFirst Do While Not rsCustomers.EOF intCustomers = rsCustomers!CustomerID intSalesperson = rsSalespeople!SalespersonID strSQL = "UPDATE Customers SET SalespersonID = " & intSalesperson & " WHERE CustomerID = " & intCustomer DoCmd.RunSQL (strSQL) rsCustomers.MoveNext If Not rsSalespeople.EOF Then rsSalespeople.MoveNext Else rsSalespeople.MoveFirst End If Loop ExitHandler: Set rsCustomers = Nothing Set rsSalespeople = Nothing Exit Sub ErrHandler: MsgBox (Err.Description) Resume ExitHandler End Sub My tables are defined like so: Customers --CustomerID --Name --SalespersonID Salespeople --SalespersonID --Name With ten customers and 5 salespeople, my intended result would like like: CustomerID--Name--SalespersonID 1---A---1 2---B---2 3---C---3 4---D---4 5---E---5 6---F---1 7---G---2 8---H---3 9---I---4 10---J---5 The above code works for the intitial loop through the Salespeople recordset, but errors out when the end of the recordset is found. Regardless of the EOF, it appears it still tries to execute the rsSalespeople.MoveFirst command. Am I not checking for the rsSalespeople.EOF properly? Any ideas to get this code to work?

    Read the article

  • Create bookmark into 1st column of MSWord table

    - by MikeD
    Hello All, does anyone have a VBA code to create a bookmark into the first column of an MSWord table? Let's say I have a table looking like this .-----.----------------. . ref . Title . .-----.----------------. . 1 . Title 1 . .-----.----------------. . 2 . Title 2 . .-----.----------------. . foo . Title 3 . .-----.----------------. . bar . Title 4 . .-----.----------------. and I want a VBA code fragment that creates a bookmark named "T1_1" on the string "1" in row 2 / column 1, and bookmarks named "T1_2", "T1_foo" and "T1_bar" on the strings in the other cells of column 1. I don't mind to hardcode the prefix "T1" (and substitute for other tables each time). I don't mind to select tables before running the macro, I don't mind giving those cells a special format, and I don't mind to get a superfluous bookmark "T1_ref" from the first row - so the code doesn't need to distinguish between table title and table row. Thanks a lot in advance

    Read the article

  • Macro VBA to get selected text in Outlook 2003

    - by balalakshmi
    I am trying to use this code snippet to get the selected text in outlook 2003 Sub SelectedTextDispaly() On Error Resume Next Err.Clear Dim oText As TextRange ''# Get an object reference to the selected text range. Set oText = ActiveWindow.Selection.TextRange ''# Check to see whether error occurred when getting text object ''# reference. If Err.Number <> 0 Then MsgBox "Invalid Selection. Please highlight some text " _ & "or select a text frame and run the macro again.", _ vbExclamation End End If ''# Display the selected text in a message box. If oText.Text = "" Then MsgBox "No Text Selected.", vbInformation Else MsgBox oText.Text, vbInformation End If End Sub When running this macro I get the error --------------------------- Microsoft Visual Basic --------------------------- Compile error: User-defined type not defined Do I need to add any references to fix this up?

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >