Visual Basic for Applications (VBA) ForumAll about VBA© 2009 Microsoft Corporation. All rights reserved.Wed, 25 Nov 2009 23:07:16 Z388e3d98-cb21-42dc-aa2e-a3956fa4f272http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e72c1c15-b7fc-44c4-a869-0e6aba9d1bf9http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e72c1c15-b7fc-44c4-a869-0e6aba9d1bf9rinuk01http://social.msdn.microsoft.com/Profile/en-US/?user=rinuk01how to assign a macro to an excel cell(click)Hello , thanks for reading<br/><br/>I have recorded a macro named &quot;mycalendar&quot;. <br/><br/>Now i want it to run when ever user clicks on any cell ranging A1:A50.<br/><br/>please help.<br/><br/>thank you.<br/><br/><br/>Wed, 25 Nov 2009 12:25:50 Z2009-11-25T23:07:16Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/4cedb7a8-6012-41a3-b880-62637c0761b5http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/4cedb7a8-6012-41a3-b880-62637c0761b5John Basedowhttp://social.msdn.microsoft.com/Profile/en-US/?user=John%20Basedowpersonal function not recalcingI created a function that returns the worksheet name, but for some reason when i open the file the functions cells all show 0, if i recall they still show 0, if i go to the cell hit f2 and enter the formula works or if i change the cell that the formula refers to it works. Whats up?<br/> <br/> <br/> Public Function GetSheetName(codeName As String)<br/> Dim wks As Worksheet<br/> codeName = WorksheetFunction.Proper(codeName)<br/> For Each wks In ActiveWorkbook.Sheets<br/> If wks.codeName = codeName Then<br/> GetSheetName = wks.Name<br/> Exit Function<br/> End If<br/> Next<br/> <br/> End Function<hr class="sig">McCWed, 25 Nov 2009 13:00:19 Z2009-11-25T22:55:01Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/6364a032-9537-4fb0-b60e-ab406a5192c2http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/6364a032-9537-4fb0-b60e-ab406a5192c2dariyooshhttp://social.msdn.microsoft.com/Profile/en-US/?user=dariyooshIs it possible to pause a Macro recording in Excel 2007?Dear all,<br/> <br/> <br/> I've just started learning VBA. Currently I'm reading a chapter about Macro recording in Word and Excel (Office 2007). Whenever I record a Macro in Word it is possible to pause the recording (but not stop it definitly) in order to avoid recording several actions which are irrelevant to our Macro. Yet, I didn't find any Pause button for recorded Macros in Excel. Is there any?<br/> <br/> Thanks in advance<br/> DariyooshWed, 25 Nov 2009 21:34:17 Z2009-11-25T22:44:36Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/8052e929-f794-4e3a-92cb-a1ad39c64a13http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/8052e929-f794-4e3a-92cb-a1ad39c64a13Eban Tomlinsonhttp://social.msdn.microsoft.com/Profile/en-US/?user=Eban%20TomlinsonMDE from Access 2007 doesn't work?Hi There, <br><br>I have created a small application in Access 2007, from which when I make an MDE (as the runtime for Access 2007 isn't yet available) the Access 2003 Runtime pops up an error saying that it was created in a newer version. <br><br>Has anyone else experienced this?<br><br>Also, in an attempt to work around this, I created an MDB from 2007, which I then opened in 2003 and made an MDE which works fine, except every time I open the MDE that works, it pops up an input box (almost like a prompt, but nothing I designed) asking for an input value for TempVars!SwitchboardID. I have the MDE configured to open the switchboard automatically.<br><br>I'm at a bit of a loss here, any chance that some of you have experienced this?<br><br>Many Thanks<br>Thu, 03 May 2007 20:04:02 Z2009-11-25T22:03:51Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/983b5f6e-165e-438a-af59-f5d24617f4f3http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/983b5f6e-165e-438a-af59-f5d24617f4f3Black_Beanhttp://social.msdn.microsoft.com/Profile/en-US/?user=Black_BeanAccessing data from a query, binding to text boxes on form (Access)<p class=MsoNormal><span style="font-size:11pt;font-family:'Arial','sans-serif'">For part of an assignment we have to query the database using one of two primary keys (it is for a fictional help desk). Those keys are User ID (the person the created the support request) and Problem reference. <br/> </span></p> <p class=MsoNormal><span style="font-size:11pt;font-family:'Arial','sans-serif'"><br/> </span></p> <p class=MsoNormal><span style="font-size:11pt;font-family:'Arial','sans-serif'">The query's are executed from a form, and when executed they open another form - which is where I am trying to get the data displayed.</span></p> <p class=MsoNormal><span style="font-size:11pt;font-family:'Arial','sans-serif'"><br/> </span></p> <p class=MsoNormal><span style="font-size:11pt;font-family:'Arial','sans-serif'">The bit that I am stuck on is grabbing the relevant data from the executed query and transferring it to the form. Because I know that I can transfer the data used in the first form and transfer it to the form. But how do I get the data from a query to be populated into the respective fields on the form?</span></p>Tue, 24 Nov 2009 22:55:09 Z2009-11-25T21:47:03Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a75fee7d-29aa-4ac7-a6af-44c250fd4f92http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a75fee7d-29aa-4ac7-a6af-44c250fd4f92edwaahttp://social.msdn.microsoft.com/Profile/en-US/?user=edwaaBug in GetOpenFilenameHere is the code:<br/><br/> <pre>Dim sDataFile As Variant Dim oDataFile As Workbook If IsEmpty(Range(&quot;F1&quot;)) Then sDataFile = Application.GetOpenFilename(FileFilter:=&quot;CSV Files (*.csv),*.csv&quot;, MultiSelect:=False) Else sDataFile = Range(&quot;F1&quot;).Value End If If sDataFile &lt;&gt; False Then Set oDataFile = Workbooks.Open(sDataFile) Else MsgBox &quot;You must select a file.&quot; End End If</pre> If you run that code (I'm running Windows 7, Excel 2007), you'll get a dialog box to choose the file but when you choose the file it actually opens it and closes the file that contains the macro! What the heck?!?Wed, 25 Nov 2009 09:05:43 Z2009-11-25T19:31:43Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/604058cd-ddd5-4754-a0d6-0301f7abcac6http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/604058cd-ddd5-4754-a0d6-0301f7abcac6BjoernBLhttp://social.msdn.microsoft.com/Profile/en-US/?user=BjoernBLAssigning recordset opened from query to recordset objectThe following source code works perfectly, except for the bold source code line <br/><strong>Set myRecordset = qryPMNames.OpenRecordset(dbOpenDynaset)<br/></strong>which throws the error: &quot;Run-time error '13': Type mismatch&quot; independent of the Open-Type (here &quot;dbOpenDynaseet&quot;) used.<br/>Do I overlook something simple regarding the assignment to the Recordset object?<br/>Do I need to use a special Recordset type, e.g. DAO, depending on the setting of the MS Access 2007 database?<br/><br/>--------------------------------------------------------------------------------------<br/>Dim i, nbPMs As Integer<br/>    Dim qryPMNames, qryPMName_MRs As QueryDef<br/>    Dim myQueries As QueryDefs<br/>    Dim myDB As Database<br/>    Dim myRecordset As Recordset<br/>    Dim strPMName, strQueryName As String<br/><br/>Set myDB = CurrentDb<br/>        With myDB<br/>            Set myQueries = .QueryDefs<br/>            Set qryPMNames = .CreateQueryDef(&quot;qryMissingResponsesPMnames&quot;, &quot;SELECT PM FROM qryAllMissingResponses_withPM GROUP BY PM&quot;)<br/>            nbPMs = qryPMNames.OpenRecordset(dbOpenDynaset).RecordCount<br/>            qryPMNames.OpenRecordset(dbOpenDynaset).MoveFirst<br/>            <strong>Set myRecordset = qryPMNames.OpenRecordset(dbOpenDynaset)<br/></strong>Wed, 25 Nov 2009 14:41:22 Z2009-11-25T18:34:05Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/2556b062-9b7a-40b7-a467-596ed7718f4fhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/2556b062-9b7a-40b7-a467-596ed7718f4fhelllmonkeyhttp://social.msdn.microsoft.com/Profile/en-US/?user=helllmonkeyRead email from outlook Inbox and save body to access table/fieldWhat I would like to do is have an event that will go to the current users inbox and check for unread mail.  I would like to add the body of the mail to a field so i can do some string manipulation to pull the data out of it that I need.  I found this code and I tried chaning it to work for me, but its not working.  I dont know anything about Outlook integration when it comes to VBA.  <br/><br/>Also, is there some knowledge base or something where I can read up on this and understand it better?<br/> <pre>Private Sub Command0_Click() Dim TempRst As DAO.Recordset Dim rst As DAO.Recordset Dim OlApp As Outlook.Application Dim Inbox As Outlook.MAPIFolder Dim InboxItems As Outlook.Items Dim Mailobject As Object Dim db As DAO.Database DoCmd.RunSQL &quot;Delete * from tbl_outlooktemp&quot; Set db = CurrentDb Set OlApp = CreateObject(&quot;Outlook.Application&quot;) Set Inbox = OlApp.GetNamespace(&quot;Mapi&quot;).getdefaultfolder(olFolderInbox) Set TempRst = CurrentDb.OpenRecordset(&quot;tbl_OutlookTemp&quot;) ' Set InboxItems = Inbox.Items ' For Each Mailobject In InboxItems If Mailobject.UnRead Then With TempRst .AddNew !Subject = Mailobject.Subject !To = Mailobject.To !Body = Mailobject.Body !DateSent = Mailobject.SentOn .Update Mailobject.UnRead = False End With End If Next Set OlApp = Nothing Set Inbox = Nothing Set InboxItems = Nothing Set Mailobject = Nothing Set TempRst = Nothing End Sub </pre>Wed, 25 Nov 2009 17:43:02 Z2009-11-25T17:43:02Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/2cd84782-e435-4b82-8ffb-1ab02a74cbcahttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/2cd84782-e435-4b82-8ffb-1ab02a74cbcaCondor10101010101http://social.msdn.microsoft.com/Profile/en-US/?user=Condor10101010101Create an array from a table rowHi all,<br/><br/>I have a row in a table (access 2007) that has 9 date columns.  I would like to grab those dates and put them into an array.  My goal is to create a function which will return the min value from all the dates in the array.  Does anyone have an example they could share?  I'm accessing the row in the table via recordset.<br/><br/>Thank you for any help with this!  :)Wed, 25 Nov 2009 00:10:02 Z2009-11-25T16:21:35Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/6f25cef8-c0f3-4d30-8c0f-d3b1aeb2764dhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/6f25cef8-c0f3-4d30-8c0f-d3b1aeb2764dZZhanghttp://social.msdn.microsoft.com/Profile/en-US/?user=ZZhangexcel vba calls c dll path<p align=left><font face=Arial size=2></font> </p> <p><span class=code-keyword>Private</span> <span class=code-keyword>Declare</span> <span class=code-keyword>Function</span> AddFun <span class=code-keyword>Lib</span> <strong><span class=code-string>&quot;C:\myfolder\MyDLL</span><span class=code-string>.dll&quot;</span></strong> ( ByVal a as Long, ByVal b as Long) <span class=code-keyword>As</span> <span class=code-keyword>Long</span></p> <p align=left><span class=code-keyword></span> </p> <p align=left><span class=code-keyword>---</span></p> <p align=left><span class=code-keyword>Hello,</span></p> <p align=left><span class=code-keyword>My  dll is written by C++. I use it in Excel 2003 VBA. I got <strong><span class=code-string>&quot;C:\myfolder\MyDLL</span><span class=code-string>.dll&quot;</span></strong>  not found error while calling it.</span></p> <p align=left><span class=code-keyword>It works fine when I add the folder to system PATH. But in my case, I like to use absolute path, and not to change PATH in users' machine.</span></p> <p align=left><span class=code-keyword></span> </p> <p align=left><span class=code-keyword>any idea? Thanks much!</span></p> <p align=left><span class=code-keyword>-ZZ</span></p>Sat, 08 Mar 2008 07:51:52 Z2009-11-25T14:28:28Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/27144795-73fc-492a-a7a2-092818d0452chttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/27144795-73fc-492a-a7a2-092818d0452csalil_tanejahttp://social.msdn.microsoft.com/Profile/en-US/?user=salil_tanejahow to change the caption of PowerPoint 2010 WindowHi, <div><br/></div> <div>Even in PowerPoint 2007, the caption property of Window was read-only (dont know why) but user can still change the caption by setting</div> <div>application.caption = &quot;changed caption value&quot;.</div> <div><br/></div> <div>But in PowerPoint 2010, even this does not work. it does not change the title of the Active Window.</div> <div>Is there any way in PowerPoint 2010 to do it?</div> <div><br/></div> <div>Thanks,</div> <div>Salil</div>Wed, 25 Nov 2009 08:37:15 Z2009-11-25T11:22:08Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fe9522ec-9db4-414f-9d2e-edac19d72859http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fe9522ec-9db4-414f-9d2e-edac19d72859Amrit_orahttp://social.msdn.microsoft.com/Profile/en-US/?user=Amrit_oraIssue in MSO shapes object for MSO 2007 SP2 installationsWe have a VBA based application that run with Excel. We are facing an issue while rendering objects like menus and tabs. The code Shapes.AddShape(msoShapeRectangle) is not working as expected while comparing to earlier MSO 2007 SP1.  Used MSO shapes object to<br/> paint the menus. Is there any change has been done on this from SP1 to SP2 ? Kindly suggest on this.Thu, 19 Nov 2009 05:52:13 Z2009-11-25T10:40:06Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/97d0e42d-a4de-4fb5-8bfd-3bf76cf41fe1http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/97d0e42d-a4de-4fb5-8bfd-3bf76cf41fe1ctubahttp://social.msdn.microsoft.com/Profile/en-US/?user=ctubaExcel 2003 Limit to Get and Set data using Range.ValueI am trying to copy data from one row in a sheet to another row in the same sheet but am getting a 1004 application (or object) defined error on this line of code:<br/> <br/> Worksheets(STOICH_SETS).Range(STOICH_FIRST_LETTER &amp; comp_row_index &amp; &quot;:&quot; &amp; STOICH_LAST_LETTER &amp; comp_row_index).Value _<br/>              = Worksheets(STOICH_SETS).Range(STOICH_FIRST_LETTER &amp; row_index &amp; &quot;:&quot; &amp; STOICH_LAST_LETTER &amp; row_index).Value<br/>            <br/> It works fine if I remove the 4 cells in each row that contain over 1600 characters, but as soon as I introduce any one of them back in I get the error.  It also works fine if I just move those larger cells separately.  Is there a limit to what I can copy this way?  <br/> <br/> ThanksThu, 19 Nov 2009 17:04:48 Z2009-11-25T10:13:35Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/64c804cb-b090-48a8-a0f0-d034fec51790http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/64c804cb-b090-48a8-a0f0-d034fec51790tswatershttp://social.msdn.microsoft.com/Profile/en-US/?user=tswaters"Document1" automatically closingGreetings!  I've encountered a problem with a VBA macro I'm working on in Word... I found a workaround and figured it would be best to post for any &amp; all. <br/> <br/> This macro uses the AutoExec sub to load some CustomXMLParts from an installed template/add-in.  Basically I run a loop over the Templates collection and when it finds the one with the correct name, a call to OpenAsDocument is made... customXMLParts are grabbed, items are added to a collection, then the document is closed.<br/> <br/> The problem is, when word is started from scratch (e.g. double click the word icon) it starts a Document 1.  When there are no changes to this document, and OpenAsDocument is called ( as will happen with the AutoExec sub ), this has the effect of closing Document 1.  After the template has been closed subsequent calls to ActiveDocument returns the error:  &quot;This command is not available because no document is open<br/> <br/> <br/> <br/> Sub AutoExec<br/> <br/> Debug.print ActiveDocument.Name  ' Document 1<br/> <br/> ' load the template<br/> <br/> For Each  oTemp In  Templates<br/>   If oTemp.Name = &quot;TheTemplate.dotm&quot; Then Exit For<br/> Next<br/> <br/> ' open the template as document<br/> Set  oDoc = oTemp.OpenAsDocument()<br/> <br/> Debug.print ActiveDocument.Name  ' TheTemplate.dotm<br/> <br/> oDoc.Close SaveChanges:=wdSaveChanges<br/> <br/> Debug.print ActiveDocument.Name<br/> <br/> ' EXPECTED:  Document 1<br/> '   RESULT: This command is not available because no document is open&lt;br/&gt;<br/> <br/> End  Sub<br/> <br/> <br/> As a workaround, I've added the following before opening the template:<br/> <br/> If Len(ActiveDocument.Path) = 0 Then<br/>   ' un-saved document<br/>   Set rng = ActiveDocument.Range(0, 0)<br/>   rng.Text = &quot; &quot;<br/>   rngSet = True<br/> End If<br/> <br/> <br/> And the following after the OpenAsDocument<br/> <br/> If rngSet = True Then<br/>   ' undo the single space addition &amp; remove object reference<br/>   rng.Text = &quot;&quot;<br/>   Set rng = Nothing<br/> End If<br/>Thu, 19 Nov 2009 00:07:39 Z2009-11-25T09:20:43Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a22a1c03-6fd6-4d66-8006-6a838fed58b2http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a22a1c03-6fd6-4d66-8006-6a838fed58b2Luck..http://social.msdn.microsoft.com/Profile/en-US/?user=Luck..Transfer data from SQL to text files<p>Hi.. </p> <p>I am completely new to SSIS..</p> <p>Can i know how to transfer tables from SQL Database to Text files(.txt)</p> <p> </p>Wed, 25 Nov 2009 08:31:56 Z2009-11-25T08:31:58Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/c8ea65af-15d4-44f1-8366-fc62c28a205chttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/c8ea65af-15d4-44f1-8366-fc62c28a205cDileep.Yhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dileep.YHide/Disable Select Multiple Items CheckBox for a pivot filterI need to hide/Disable select Multiple Items check box in  Pivot Filters<br/>How can i achieve this through VBA or through MS office settings? <hr class=sig> Thanks DileepWed, 25 Nov 2009 08:15:33 Z2009-11-25T08:15:34Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fbf3c4c6-b744-4ae1-8210-9d8dd94aef25http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fbf3c4c6-b744-4ae1-8210-9d8dd94aef25pratikananhttp://social.msdn.microsoft.com/Profile/en-US/?user=pratikananEventLogHi Gurus,<br/><br/>Please let me know how to write logs to EventLog of the system through VBA.<br/><br/>Cheers.Fri, 20 Nov 2009 11:29:51 Z2009-11-25T04:25:52Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/de4bb7b5-abd2-42a6-8f24-ac30d72c14adhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/de4bb7b5-abd2-42a6-8f24-ac30d72c14admilanjthttp://social.msdn.microsoft.com/Profile/en-US/?user=milanjtPowerpoint Build in command not working in 2007.Hello All,<br/> <br/> I am in the process of porting a DLL file (COM Add-In) from Powerpoint 2003 to 2007.<br/> <br/> The idea is to make sure all the commands work in 2007. I am not modifying the ribbon etc.<br/> <br/> Following code add a Button to a custom toolbar which is for the Subscript button. It works perfectly fine in 2003 but not in powerpoint 2007.<br/> Set mobjCmdBar = Application.CommandBars.Add(Name:=&quot;CustomCommandBar&quot;)<br/>     mobjCmdBar.Visible = True<br/> mobjCmdBar.Controls.Add  Type:=msoControlButton, Id:=58<br/> <br/> Icon is properly shown in 2007 however it just does not Subscript the selected text. Nor does it give any error in PP 2007.  <br/> <br/> Any ideas or suggestions?<br/> <br/> Thanks.Tue, 17 Nov 2009 21:06:39 Z2009-11-25T03:52:16Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/afba1cbd-dc0b-4d5d-9f5a-959c73304e55http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/afba1cbd-dc0b-4d5d-9f5a-959c73304e55holywinhttp://social.msdn.microsoft.com/Profile/en-US/?user=holywinhelp out! docmd.runsql "..." get error 2051<div>Using VBA in Excel 2002 , Access 2003 created a report tool .runs well.<br/>until last week we update access2003 to 2007.(excel still 2002).<br/>get error for grammar :&quot; docmd.RunSQL &quot;update .... &quot; &quot;<br/>Error message show &quot;The RunSQL action was canceled.&quot;<br/><br/>Reference:<br/>1. Visual Basic for Application<br/>C:\Program Files\Common Files\Micorsoft Shared\VBA\VBE6.DLL<br/>2. OLE Automation<br/>C:\WINDOWS\SYSTEM32\STDOLE2.TLB<br/>3. Microsoft Access 12.0 Object Library<br/>C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE12\MSACC.OLB<br/>4. Microsoft Excel DAO Object Library<br/>C:\Program Files\Common Files\Micorsoft Shared\DAO\DAO360.DLL<br/>5. Microsoft ActiveX Data Objects 2.8 Library<br/>C:\Program Files\Common Files\system\ado\msado15.tlb<br/>6. Micorsoft Forms2.0 Object Library<br/>C:\WINDOWS\SYSTEM32\FM20.DLL<br/>7. Micorsoft Office 12.0 Object Library<br/>C:\Program Files\Common Files\Micorsoft Shared\OFFICE12\MSO.DLL<br/>8. Microsoft Excel 10.0 Object Library<br/>C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\EXCEL10.EXE</div>Tue, 24 Nov 2009 22:01:23 Z2009-11-24T23:25:43Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/d39f7567-4e96-473c-bd4a-e340631a28f7http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/d39f7567-4e96-473c-bd4a-e340631a28f7Joe Houstonhttp://social.msdn.microsoft.com/Profile/en-US/?user=Joe%20HoustonDoCmd.OutputTo does not work from a library database using acFormatSNP or acFormatPDF<p align=left><font face=Arial size=2>I have a library database that contains a function designed to output reports in snapshot format using docmd.OutputTo with the acFormatSNP option.  I developed the library in Access 2003 along with several front-end databases that reference the library and use the function to output reports that are located in the front-end database.</font></p> <p align=left><font face=Arial size=2></font> </p> <p align=left><font face=Arial size=2>This all works in Access 2003, but not in 2007.  I get Error #2059 saying that the report cannot be found.  Calling OutputTo directly in the front-end database works fine.</font></p> <p align=left> </p> <p align=left>I have also tried this with the new SaveToPDF add-in and the acFormatPDF format.  Same result - works locally but not in the library.</p> <p align=left> </p> <p align=left>Extremely simplified sample code follows:</p> <p align=left> </p> <p align=left>Database1 (front-end)</p> <p align=left> </p> <blockquote dir=ltr style="margin-right:0px"> <p align=left><u>Form1</u></p> <p align=left><br>Private Sub Command1_Click()</p> <p align=left>Output_Local</p> <p align=left>End Sub</p> <p align=left> </p> <p align=left>Private Sub Command2_Click()</p> <p align=left>Output_Library</p> <p align=left>End Sub</p> <p align=left> </p> <p align=left><u>Module1</u></p> <p align=left> </p> <p align=left>Function Output_Local()</p> <p align=left>DoCmd.OutputTo acOutputReport, &quot;Report1&quot;, acFormatSNP, CurrentProject.Path &amp; &quot;\Report1.snp&quot;, True</p> <p align=left>End Function</p></blockquote> <p dir=ltr align=left> </p> <p dir=ltr align=left>Database2 (library)</p> <p dir=ltr align=left> </p> <blockquote dir=ltr style="margin-right:0px"> <p dir=ltr align=left><u>Module1</u></p> <p dir=ltr align=left> </p> <p dir=ltr align=left>Function Output_Library()</p> <p dir=ltr align=left>DoCmd.OutputTo acOutputReport, &quot;Report1&quot;, acFormatSNP, CurrentProject.Path &amp; &quot;\Report1.snp&quot;, True</p> <p dir=ltr align=left>End Function<br></p></blockquote> <p dir=ltr align=left> </p> <p dir=ltr align=left>In Database1, I set a reference to Database2.</p> <p dir=ltr align=left>In Form1:</p> <blockquote dir=ltr style="margin-right:0px"> <p dir=ltr align=left>Command1 outputs the report in snapshot format</p> <p dir=ltr align=left>Command2 gives the following error:</p></blockquote> <p dir=ltr align=left> </p> <blockquote dir=ltr style="margin-right:0px"> <p dir=ltr align=left>Run-time error '2059':</p> <p dir=ltr align=left>Microsoft Office Access cannot find the object 'Report1'.</p></blockquote> <p dir=ltr align=left> </p> <blockquote dir=ltr style="margin-right:0px"> <p dir=ltr align=left>The 'Debug' button takes me to the OutputTo statement in the library database. </p></blockquote> <p dir=ltr align=left> </p> <p> </p> <p align=left>I can't come up with any explanation other than a bug in Access 2007.  It works fine in 2003.  The VBA help docs in 2007 still claim that it should be able to output a report in the current database from a library database.  The actual production code is a bit more complex, so I don't want to have to copy it out of the library into a bunch of separate databases.</p> <p align=left> </p> <p align=left>Any ideas?</p> <p align=left> </p> <p align=left>Thanks</p>Tue, 08 Jul 2008 21:54:40 Z2009-11-24T22:06:34Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/456869d4-9215-47e6-86bc-5d1bc978e04chttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/456869d4-9215-47e6-86bc-5d1bc978e04cJames Humphhttp://social.msdn.microsoft.com/Profile/en-US/?user=James%20HumphSaveAs method appending .xls to filenameHi, am hoping someone more knowledgeable than I might be able to shed some light on an Excel / VBA issue I've encounted:<br/> <br/> I've got some VBA code which saves a workbook but uses the extension plan instead of xls.  E.g. &quot;site1.plan&quot; as opposed to &quot;site1.xls&quot;<br/> The code runs fine on my development PC but when run on a remote server via an RDP session, .xls is appended onto the filename, e.g. site1.plan.xls<br/> <br/> I'm struggling to understand why this is happening.<br/> <br/> If I save the file using File|Save As, the filename is correct and .xls isn't added.<br/> Using the SaveAs method and an extension that isn't .plan, e.g, .test or .abc works fine.<br/> I'm using Excel 2002 (10.6501.6626) SP3.<br/> <br/> I've run through a Process Monitor trace of Excel's file system and registry activity to see if there was any suspicious calls but nothing jumped out.  No references to the original filename without the .xls extension for example.<br/> <br/> The same code has been working correctly for the past 5+ years and this problem has only occurred after loading Excel (and the workbook) onto a new server.<br/> <br/> Any ideas anyone?Fri, 20 Nov 2009 18:43:46 Z2009-11-24T19:34:08Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/532e6287-fe75-45c0-aaab-71975d7714a9http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/532e6287-fe75-45c0-aaab-71975d7714a9Condor10101010101http://social.msdn.microsoft.com/Profile/en-US/?user=Condor10101010101Cannot fully close Exce;Hi all,<br/><br/>I have an access app which open up a query in Excel then I tweak the excel with vba and finally close it.  However, when I close it I look at the processes running still and there's still an Excel instance.  How can I completely close Excel.  Here's a sample of my code.<br/><br/> <pre lang=x-vbnet>Function outputToExcel() Dim myQuery As QueryDef Dim openTable As TableDef Dim dbCurrent As Database Set dbCurrent = DBEngine.Workspaces(0).Databases(0) DoCmd.RunSavedImportExport &quot;Import-table&quot; 'Imports table DoCmd.RunSavedImportExport &quot;Export-qry&quot; 'Export qry to Excel Dim xlApp As Excel.Application Dim xlWB As Excel.Workbook Dim xlWs As Excel.Worksheet Set xlApp = CreateObject(&quot;Excel.Application&quot;) Set xlWB = xlApp.Workbooks.Open(&quot;c:\temp\output.xlsx&quot;) Set xlWs = xlWB.ActiveSheet Dim rsState As DAO.Recordset Set rsState = dbCurrent.OpenRecordset(&quot;qry_2&quot;) xlApp.DisplayAlerts = False xlWB.SaveAs &quot;C:\temp\output.xlsx&quot;, FileFormat:=51 xlApp.DisplayAlerts = True rsState.Close Set rsState = Nothing Set myQuery = Nothing Set openTable = Nothing dbCurrent.Close Set dbCurrent = Nothing xlWB.Save xlWB.Close , &quot;C:\temp\output.xlsx&quot; xlApp.Quit Set xlWs = Nothing Set xlWB = Nothing Set xlApp = Nothing MsgBox &quot;Completed&quot; End Function</pre> Does anyone see what I need to close?  Thank you!Tue, 24 Nov 2009 08:36:11 Z2009-11-24T17:17:48Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/99a88a98-d702-41b5-89cc-47b754b783b4http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/99a88a98-d702-41b5-89cc-47b754b783b4Karl0709http://social.msdn.microsoft.com/Profile/en-US/?user=Karl0709Excel Macro HelpNeed help creating a macro that will find a value in a sheet and store it as a variable.  Then also store values from cells in variables that are adjacent to the cell found in the &quot;find&quot;.Tue, 24 Nov 2009 16:51:44 Z2009-11-24T16:51:44Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/dd379d09-42d3-4947-bd26-6ca551b98493http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/dd379d09-42d3-4947-bd26-6ca551b98493Condor10101010101http://social.msdn.microsoft.com/Profile/en-US/?user=Condor10101010101Help with Progress Bar - getting error 7952 (acSysCmdUpdateMeter)Hi All,<br/><br/>I have an access app and I'm trying to incorporate a progress bar as a function loops through a query recordset.  <br/><br/>I'm able to initiate the progress bar by:<br/><br/> <pre>syscmd acSysCmdInitMeter, message, total#</pre> <br/>but when I try to increment the progress bar:<br/><br/><br/> <pre>syscmd acSysCmdUpdateMeter, progress# </pre> I get error: '7952 You made an illegal function call'<br/><br/>Any ideas how to fix this?<br/><br/>Thank you!Wed, 04 Nov 2009 08:00:45 Z2009-11-25T21:32:45Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/194179c1-a0a9-4151-b481-c2565897e857http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/194179c1-a0a9-4151-b481-c2565897e857willllllllhttp://social.msdn.microsoft.com/Profile/en-US/?user=willllllllVideo Capture with Audio<p>Hi,<br/>I'm new to the world of programming and am trying to put together a video capture and playback programme. The capturing of video works fine, however, I am capturing from a DV camcorder via firewire and the audio that is captured is taken from the microphone on the computer rather than from the camcorder. does anyone know how to rectify this, any help would be massively aprreciated. It should also be noted I am making this in excel 2002, an extract from the code is shown below, <br/>many thanks,<br/><br/>Private Declare Function GetSystemMetrics Lib &quot;user32.dll&quot; (ByVal nIndex As Long) As Long<br/>Const SM_CXSCREEN = 0<br/>Const SM_CYSCREEN = 1<br/>Private Declare Function mciSendString Lib &quot;winmm.dll&quot; Alias &quot;mciSendStringA&quot; (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long<br/>Private Declare Function mciGetErrorString Lib &quot;winmm.dll&quot; Alias &quot;mciGetErrorStringA&quot; (ByVal dwError As Integer, ByVal lpstrBuffer As String, ByVal uLength As Integer) As Integer<br/>Declare Function FindWindow Lib &quot;user32&quot; Alias &quot;FindWindowA&quot; (ByVal lpClassName As String, ByVal lpWindowName As String) As Long<br/>Declare Function capCreateCaptureWindow Lib &quot;avicap32.dll&quot; Alias &quot;capCreateCaptureWindowA&quot; (ByVal a As String, ByVal b As Long, ByVal c As Integer, ByVal d As Integer, ByVal e As Integer, ByVal f As Integer, ByVal g As Long, ByVal h As Integer) As Long<br/>Public Declare Function SendMessage Lib &quot;user32&quot; Alias &quot;SendMessageA&quot; (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long<br/>Global Const ws_child As Long = &amp;H40000000<br/>Global Const ws_visible As Long = &amp;H10000000<br/>Global Const WM_USER = 1024<br/>Global Const wm_cap_driver_connect = WM_USER + 10<br/>Global Const wm_cap_set_preview = WM_USER + 50<br/>Global Const WM_CAP_SET_PREVIEWRATE = WM_USER + 52<br/>Global Const WM_CAP_DRIVER_DISCONNECT As Long = WM_USER + 11<br/>Global Const WM_CAP_DLG_VIDEOFORMAT As Long = WM_USER + 41<br/>Global Const WM_CAP_SEQUENCE = WM_USER + 62<br/>Global Const WM_CAP_FILE_SAVEAS = WM_USER + 23<br/>Global Const WM_CAP_DISCONNECT As Long = 1035<br/>Global Const WM_CAP_GET_STATUS As Long = WM_USER + 54<br/>Global Const WM_CAP_FILE_SET_CAPTURE_FILE As Long = WM_USER + 20<br/>Global Const WM_CAP_FILE_ALLOCATE As Long = WM_USER + 22<br/>Global Const WM_CAP_SET_SEQUENCE_SETUP As Long = WM_USER + 64<br/>Global Const WM_CAP_GET_SEQUENCE_SETUP As Long = WM_USER + 65<br/>Global Const WM_CAP_GET_VIDEOFORMAT As Long = WM_USER + 44<br/>Global Const WM_CAP_SEQUENCE_NOFILE As Long = WM_USER + 63<br/>Global Const WM_CAP_STOP As Long = WM_USER + 68<br/>Private Type POINTAPI<br/>    x As Long<br/>    y As Long<br/>End Type<br/>Type CAPTUREPARMS<br/>    dwRequestMicroSecPerFrame As Long<br/>    fMakeUserHitOKToCapture As Long<br/>    wPercentDropForError As Long<br/>    fYield As Long<br/>    dwIndexSize As Long<br/>    wChunkGranularity As Long<br/>    fUsingDOSMemory As Long<br/>    wNumVideoRequested As Long<br/>    fCaptureAudio As Long<br/>    wNumAudioRequested As Long<br/>    vKeyAbort As Long<br/>    fAbortLeftMouse As Long<br/>    fAbortRightMouse As Long<br/>    fLimitEnabled As Long<br/>    wTimeLimit As Long<br/>    fMCIControl As Long<br/>    fStepMCIDevice As Long<br/>    dwMCIStartTime As Long<br/>    dwMCIStopTime As Long<br/>    fStepCaptureAt2x As Long<br/>    wStepCaptureAverageFrames As Long<br/>    dwAudioBufferSize As Long<br/>    fDisableWriteCache As Long<br/>    AVStreamMaster As Long<br/>End Type<br/>Type CAPSTATUS<br/>    uiImageWidth As Long<br/>    uiImageHeight As Long<br/>    fLiveWindow As Long<br/>    fOverlayWindow As Long<br/>    fScale As Long<br/>    ptScroll As POINTAPI<br/>    fUsingDefaultPalette As Long<br/>    fAudioHardware As Long<br/>    fCapFileExists As Long<br/>    dwCurrentVideoFrame As Long<br/>    dwCurrentVideoFramesDropped As Long<br/>    dwCurrentWaveSamples As Long<br/>    dwCurrentTimeElapsedMS As Long<br/>    hPalCurrent As Long<br/>    fCapturingNow As Long<br/>    dwReturn As Long<br/>    wNumVideoAllocated As Long<br/>    wNumAudioAllocated As Long<br/>End Type<br/><br/>Sub ImportDevice()</p> <p>Dim temp As Long<br/>Dim hwand As Long<br/>Dim hwdc As Long<br/>Dim x As Long<br/>Dim y As Long<br/>Dim capst As CAPSTATUS<br/>Dim CapParam As CAPTUREPARMS</p> <p>x = GetSystemMetrics(SM_CXSCREEN)<br/>y = GetSystemMetrics(SM_CYSCREEN)<br/>If Tag.FLocation.Caption = &quot;&quot; Then<br/>    MsgBox (&quot;Select File Name First&quot;)<br/>    Exit Sub<br/>End If<br/>Capture.Show<br/>hwand = FindWindow(&quot;ThunderDFrame&quot;, Capture.Name)<br/>hwdc = capCreateCaptureWindow(&quot;Capture Window&quot;, ws_child Or ws_visible, 0, 0, (x * 0.43), (y * 0.47), hwand, 0)<br/>If (hwdc &lt;&gt; 0) Then<br/>    temp = SendMessage(hwdc, wm_cap_driver_connect, 0, 0&amp;)<br/>    If temp = 0 Then<br/>        MsgBox (&quot;Failure to connect to device&quot;)<br/>        Exit Sub<br/>    End If<br/>    temp = SendMessage(hwdc, wm_cap_set_preview, 1, 0&amp;)<br/>    temp = SendMessage(hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0&amp;)<br/>    temp = SendMessage(hwdc, WM_CAP_FILE_SET_CAPTURE_FILE, 0&amp;, Tag.FLocation.Caption)<br/>    temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOFORMAT, 0&amp;, 0&amp;)<br/>    temp = SendMessage(hwdc, WM_CAP_GET_STATUS, Len(capst), VarPtr(capst))<br/>    temp = SendMessage(hwdc, WM_CAP_GET_SEQUENCE_SETUP, Len(CapParam), VarPtr(CapParam))<br/>    CapParam.fYield = 1<br/>    CapParam.fAbortLeftMouse = 0<br/>    temp = SendMessage(hwdc, WM_CAP_SET_SEQUENCE_SETUP, Len(CapParam), VarPtr(CapParam))<br/>    Tag.Handle.Caption = hwdc<br/>End If</p> <p>End Sub</p> <p>Sub StartCapture()</p> <p>Dim temp As Long<br/>Dim hwdc As Long</p> <p>Tag.StartCapture.Visible = False<br/>Tag.StopCapture.Visible = True</p> <p>hwdc = Tag.Handle.Caption<br/>If (hwdc &lt;&gt; 0) Then<br/>    temp = SendMessage(hwdc, WM_CAP_SEQUENCE, 0&amp;, 0&amp;)<br/>End If</p> <p>End Sub</p> <p>Sub StopCapture()</p> <p>Dim temp As Long<br/>Dim hwdc As Long</p> <p>Tag.StartCapture.Visible = True<br/>Tag.StopCapture.Visible = False</p> <p>hwdc = Tag.Handle.Caption<br/>If (hwdc &lt;&gt; 0) Then<br/>    temp = SendMessage(hwdc, WM_CAP_STOP, 0&amp;, 0&amp;)<br/>End If</p> <p>End Sub</p>Tue, 24 Nov 2009 16:31:21 Z2009-11-24T16:31:22Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/96b03ab9-8208-4ce1-a9a9-c74c5e181b35http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/96b03ab9-8208-4ce1-a9a9-c74c5e181b35jonathanDnhttp://social.msdn.microsoft.com/Profile/en-US/?user=jonathanDnDocument_XMLBeforeDelete does not catch single 'Delete' clicksI've been testing Document_XMLBeforeDelete event behaviour in Word 2007 VBA. I've come to the conclusion that this event is triggered only when one whole XmlNode (start and end tag with contents obviously) is in the DeletedRange. <br/><br/>Punching single Delete keystrokes delete the start and end tags fine, but without triggering the XMLBeforeDelete event. Does anyone have a workaround for this? Testing for single Delete keystrokes?<br/><br/>JonathanThu, 19 Nov 2009 14:53:15 Z2009-11-24T10:11:36Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/57195ae2-6235-4f11-8325-152a1c2f88ddhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/57195ae2-6235-4f11-8325-152a1c2f88ddRenan Aushttp://social.msdn.microsoft.com/Profile/en-US/?user=Renan%20AusUsing DIR from Excel VBA to list SharePoint Shared Documents<div class=ExternalClassF4DCF6C306C94A99AA2B90325D1D34A6> <div>Hi Everybody,</div> <div> </div> <div>I have a number of excel files in SharePoint with data for different countries. They all have the same formatting and number of columns and are all .xlsm files.</div> <div> </div> <div>The idea is to get all data from these separate files and to merge them into a master spreadsheet I called Summary.xls. From this summary, it will be possible to have a pivot table for all managers to have an overview of the consolidated data from all countries.</div> <div> </div> <div>I have put together a macro on Summary.xls to search for *.xlsm on a particular folder, open each file and copy its content into Summary.xls. This works fine locally, but when I change the path from &quot;C:\folder\name&quot; to something like &quot;\\hostname.com\teams\NAME\Shared Folders&quot; it simply doesn't work. Apparently I can't use the pathway like that because the files are stored on a Web Server, so I would have to use the \Forms\AllItems.aspx somehow to retrieve that information.</div> <div> </div> <div>Here is an example of the code I'm using:</div> <div> </div> <div>Sub Update_Summary()<br/>Dim oWbk As Workbook<br/>Dim sFil As String<br/>Dim sPath As String<br/>Dim answer As String</div> <div>sPath = &quot;\\hostname.com\teams\NAME\Shared Folders&quot;<br/></div> <div>'sPath = &quot;C:\Users\me\Documents\Data&quot;<br/>'The local directory works just fine<br/> </div> <div>ChDir sPath</div> <div> </div> <div>sFil = Dir(&quot;*.xlsm&quot;)<br/></div> <div>'The issue is that here it can't find any .xlsm file, so the next line will end the loop<br/>Do While sFil &lt;&gt; &quot;&quot;<br/>Set oWbk = Workbooks.Open(sPath &amp; &quot;\&quot; &amp; sFil)<br/>oWbk.Close False<br/>sFil = Dir<br/>Loop</div> <div> </div> <div>End Sub</div> <div> </div> <div> </div> <div>Any ideas?</div> <div> </div> <div>Thank you all.</div> </div>Wed, 18 Nov 2009 22:55:15 Z2009-11-24T09:55:41Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e153ac38-899d-4bf2-bd57-47825c4ba901http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e153ac38-899d-4bf2-bd57-47825c4ba901Frenchie1965http://social.msdn.microsoft.com/Profile/en-US/?user=Frenchie1965Changing 01/01/2009 to JANHi,<br/>I am a real novice who is learning slowly. <br/>I have cells with the date of 01/01/2009 up to 31/12/2009. <br/> I want to add a column (I can do that bit) with just the month of the date<br/><br/>so 01/01/2009 would become JAN <br/>06/02/2009 would become FEB. <br/><br/>Any ideas how I could do this please.Wed, 18 Nov 2009 10:45:55 Z2009-11-24T09:08:12Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/2e662c1c-c056-4606-ab73-24b8890ce07chttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/2e662c1c-c056-4606-ab73-24b8890ce07cLuck..http://social.msdn.microsoft.com/Profile/en-US/?user=Luck..How to retrieve data from SQl/Microsift access to VBA(Excel )Hi.. i am new to VBA.. Can any one please suggest me coding for the issue.<br/>I have tried this code: (Available in net) ..but getting automation error.<br/><br/>Can any one check and resolve the problem.<br/><br/><br/><br/>Sub GetDataFromSQL()<br/>      <br/>   <br/>        Dim objMyConn As ADODB.Connection<br/>        Dim objMyCmd As ADODB.Command<br/>        Dim objMyRecordset As ADODB.Recordset<br/> <br/>        Set objMyConn = New ADODB.Connection<br/>        Set objMyCmd = New ADODB.Command<br/>        Set objMyRecordset = New ADODB.Recordset<br/> <br/>         objMyConn.ConnectionString = &quot;Provider=SQLOLEDB;Data Source=XXX;Initial catalog=YYY;User ID=abc;Password=abc&quot;  ( Even i changes Integrated Security=true)<br/><br/>        objMyConn.Open<br/> <br/>  <br/>        Set objMyCmd.ActiveConnection = objMyConn<br/>        objMyCmd.CommandText = &quot;select * from Emp1&quot;<br/>        objMyCmd.CommandType = adCmdText<br/> <br/> <br/>        Set objMyRecordset.Source = objMyCmd<br/>        objMyRecordset.Open<br/> <br/>   <br/>        ActiveSheet.Range(&quot;A1&quot;).CopyFromRecordset objMyRecordset<br/> <br/>End Sub<br/><br/><br/> Thu, 19 Nov 2009 10:07:33 Z2009-11-24T10:08:58Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fe0dbb5e-2e0b-41f4-839c-517837d3002dhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fe0dbb5e-2e0b-41f4-839c-517837d3002dPhilsophaiehttp://social.msdn.microsoft.com/Profile/en-US/?user=PhilsophaiePass variables between subroutinesI would like to combine several into one variable &quot;parameters&quot; to pass between subroutines. <br/><br/>sub ThisSub()<br/>dim parameters as _______<br/>...<br/>parameters.a1=a1<br/>parameters.a2=a2<br/>parameters.a3=a3<br/>...<br/>parameters.a10=a10<br/><br/>ThatSub(parameters)<br/>end sub<br/><br/>Sub ThatSub(parameters as ______)<br/>a1=parameters.a1<br/>a2=parameters.a2<br/>a3=parameters.a3<br/>...<br/>a10=parameters.a10<br/>end sub<br/><br/>In vb.net you use a Public Class to define &quot;parameters&quot;.  How do you do it in VBA?Fri, 20 Nov 2009 20:04:22 Z2009-11-24T06:28:18Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/d4d39a10-cbf3-4fc2-a725-cd5b7464393bhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/d4d39a10-cbf3-4fc2-a725-cd5b7464393bMikeSierrahttp://social.msdn.microsoft.com/Profile/en-US/?user=MikeSierraMultiple Pivot Table Filter UpdateI created some code that changes the filter selected on PivotTable1 to the other 9 Pivots on the same worksheet, but I had to create a button to trigger the macro. I've done VBA in Access and know that there is a AfterUpdate trigger, does excel have this to? I want to run the macro after the filter selection has been made in the pivot table. Thanks MASFri, 20 Nov 2009 19:22:14 Z2009-11-24T06:22:50Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/34f7303f-3b67-4fea-b5cc-b1ef7a00d697http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/34f7303f-3b67-4fea-b5cc-b1ef7a00d697whburlinghttp://social.msdn.microsoft.com/Profile/en-US/?user=whburlingVBA editor does not seem to resetI am running excel 2003<br/><br/>while trouble shooting my code, I hit run-&gt;reset and then debug-&gt;step into<br/>to begin another round.  <br/><br/>However, I don't seem to get a consistent reset as indicative of the fact the<br/>editor does not step into my code when I command it to do so. (no yellow highlight and no movement of the cursor)<br/><br/>What am I doing wrong so I can consistently get my code to reset and not have to fumble around until<br/>something magically happens so that I can proceed.<br/><br/>My hardware is sound. I think I am not cleanly ending my code in some manner and that is my problem.<br/><br/>Bil<br/>Fri, 20 Nov 2009 22:44:52 Z2009-11-24T06:16:58Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/81b85380-2ea5-4503-8d14-d88161feb3d4http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/81b85380-2ea5-4503-8d14-d88161feb3d4manny2364http://social.msdn.microsoft.com/Profile/en-US/?user=manny2364how to save pictures from excel in another folderHi<br/> <br/> I have several excel files with pictures in them.<br/> I would like to save the pictures so i can use them on my website.they were sebt to me for this purpose.<br/> When i right click on a picture the SAVE AS is not shown.<br/> <br/> any clues of how to do it,<br/> <br/> ThanksSun, 22 Nov 2009 19:11:18 Z2009-11-24T06:12:36Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/6a6f7881-f48b-454c-a887-d0a52b47463ehttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/6a6f7881-f48b-454c-a887-d0a52b47463eilivnihttp://social.msdn.microsoft.com/Profile/en-US/?user=ilivniFormula does not calculate<span style="font-family:Arial;font-size:medium"> <div style="color:#000000;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:67%;background-image:initial;background-repeat:initial;background-attachment:initial;background-color:#ffffff;margin:8px">I have a piece of code that does the following: <div><br/></div> <div><ol> <li>Grabs a cell.value from another worksheet places it in the new worksheet A1</li> <li>Formula in B1 reads A1 and should update resulting in a string</li> </ol>Unfortunately this Formula does not update unless i exit the macro.  The formula is:</div> <div><ol> <li>Developed by a third party </li> <li>I have tried to do this Range(&quot;B1&quot;).calculate</li> <li>Put timer loops to give the formula time to pull the data it needs</li> </ol>None of this works unless I exit the macro, the minute I do the Formula gives the desired result.</div> <div><br/></div> <div>Thank you in advance<br/></div> </div> </span>Sun, 22 Nov 2009 22:56:46 Z2009-11-24T06:02:32Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/1e549ed9-cde3-4278-a16f-dedcce9aa5cahttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/1e549ed9-cde3-4278-a16f-dedcce9aa5caDileep.Yhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dileep.Yhow to get visible items count of a pivot field (pivot table report on table/view)<p>I would like to get visible items count of a pivot field (pivot table report on table/view)<br/><br/>if my PivotReport is connected to cube i can get it from PivotFields.VisibleItemsList.Count<br/><br/>This is not working in pivot table report from a SQL table/view</p> <hr class=sig> Thanks DileepTue, 24 Nov 2009 05:54:28 Z2009-11-24T05:54:29Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/841e3cd9-d949-45bb-9462-586b59c2546chttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/841e3cd9-d949-45bb-9462-586b59c2546cMatt Owenshttp://social.msdn.microsoft.com/Profile/en-US/?user=Matt%20OwensRefresh Excel Pivot Table using data from SQL Server<p>Hi,<br/><br/>Can anyone help me refresh an excel pivot table, on a given event (sheet_Activate or similar), by calling a reselect on a view in SQL server.<br/><br/>I can't find code anywhere on the internet to do it.<br/><br/>Thanks and warm regards,<br/></p>Tue, 24 Nov 2009 03:08:42 Z2009-11-24T05:50:41Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/650213a1-20fc-4e15-b7a5-38c7ad94b077http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/650213a1-20fc-4e15-b7a5-38c7ad94b077Bittiehttp://social.msdn.microsoft.com/Profile/en-US/?user=BittieCheckSpelling in Word containing protected fieldsIs anyone able to guide me on the following post from the Kiwi Koder:<br/> <br/> <pre class=FreeTextFull>While the article at http://word.mvps.org/faqs/macrosvba/SpellcheckProtectDoc.htm is great if you<br/> want to check the spelling of the information input into formfields, my problem is a bit different. <br/> I have (Word 2003) templates that produce forms-<span class=hilite4>protected</span> documents, but the documents themselves <br/> don't contain any formfields. I use forms protection only because it allows me to protect only<br/> certain sections of the document, such as the header and footer, while leaving other sections, <br/> such as the main body of the document unprotected.<br/> The spellchecker checks the spelling <span class=hilite2>in</span> the unprotected sections OK, and I don't really mind if it <br/> doesn't check the spelling <span class=hilite2>in</span> the <span class=hilite4>protected</span> sections because 1) I know that I haven't made any spelling <br/> errors <span class=hilite2>in</span> the 'boilerplate' <span class=hilite2>in</span> these sections; and 2) if the user has made a spelling error <span class=hilite2>in</span> the 'variable' information, they can just rerun the code <span class=hilite2>in</span> template to correct the errors. However, <br/> there is a deficiency <span class=hilite2>in</span> the native spellchecker that I've been asked to develop a workaround for.<br/> <span class=hilite2>In</span> an unprotected document, if none of the choices <span class=hilite2>in</span> the 'Suggestions' list are viable, you can just <br/> type <span class=hilite2>in</span> the '<span class=hilite1>Not</span> <span class=hilite2>in</span> <span class=hilite3>Dictionary</span> ' box to make the change. However, this doesn't work <span class=hilite2>in</span> a <span class=hilite4>protected</span> document; the text <span class=hilite2>in</span> the '<span class=hilite1>Not</span> <span class=hilite2>in</span> <span class=hilite3>Dictionary</span> ' box is treated like it's <span class=hilite2>in</span> a <span class=hilite4>protected</span> section. I could<br/> always write code that unprotects the document before displaying the spellchecker, but there are a couple <br/> of drawbacks:<br/> First, this will allow the users to spellcheck the <span class=hilite4>protected</span> sections as well, which is <span class=hilite1>not</span> really a major <br/> problem except that if the user corrects an error that was introduced through the input of the 'variable' <br/> information described above, this correction won't get replicated back into the data from the UserForm. <br/> Thus if the user reruns the template, the correction won't be there and the error could be reintroduced <br/> without the user realising it. However, I can live with this.<br/> The real problem is that the spellchecker dialog isn't modal to Word. Therefore, if I unprotect the <br/> document, the user now has full access to the whole document, _including_ the <span class=hilite4>protected</span> sections. And <br/> believe me, the users will take advantage of this whenever possible; I learned this when I told the users I was going to fix a bug <span class=hilite2>in</span> my code that left the document unprotected and got a... umm... less <br/> than favourable response. ;-D<br/> Does anyone know a way to enable the editing capability <span class=hilite2>in</span> the '<span class=hilite1>Not</span> <span class=hilite2>in</span> <span class=hilite3>Dictionary</span> ' box without <br/> unprotecting the document? Or will my users just have to live with this limitation? (The second choice <br/> is acceptable as I'm quite happy to tell the users 'No' - as long as I can justify the response.)</pre> <br/> Thanks!Tue, 24 Nov 2009 02:27:14 Z2009-11-24T02:27:15Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fb4e1ef4-0b65-46fe-a872-cb2eea70d3a6http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/fb4e1ef4-0b65-46fe-a872-cb2eea70d3a6SteveatHomehttp://social.msdn.microsoft.com/Profile/en-US/?user=SteveatHomeCan date created and date modified etc be set from code?Please can anyone help.  I need to be able to set the date last modified, and ideally the date created (but I can work round this by copying the file) of files in the operating system filing system (not tables in Access) I cannot seem to find any way of doing this from VBA in Access 2007.  Is it possible and if so how?  Thanks.  SteveMon, 23 Nov 2009 20:31:34 Z2009-11-23T20:31:36Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e3de4e1e-ae0f-4be9-af84-1eeb9c6d2e8dhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/e3de4e1e-ae0f-4be9-af84-1eeb9c6d2e8dLuck..http://social.msdn.microsoft.com/Profile/en-US/?user=Luck..How to call VBA userform from Excel Button (or) How to call VBA userform from workbookHi , <br/><br/>I have taken an autoshape in Excel ( for button).<br/>In VBA i ahve one form.<br/><br/>So, my issue is .. how can we access VBA form through the button in excel<br/><br/>or                       how can we access VBA form through Thisworkbook in VBA project<br/><br/><br/>Please help me in this issueMon, 23 Nov 2009 10:20:05 Z2009-11-23T10:46:56Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/4eafebdd-9ff5-4f0a-ace5-9552aa9dd2cfhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/4eafebdd-9ff5-4f0a-ace5-9552aa9dd2cfWaterstarhttp://social.msdn.microsoft.com/Profile/en-US/?user=Waterstarread propertiesUsing Visual Studio (VB) I need to get the author and category properties from a closed access.adp (2000 version) file, as a means of checking the version no (which I've entered in the category property), so that if a user's application in their C: drive has been superceded I can copy an update version from the network.  I tried the filesystemobject but it only gives geneal properties such as file size.  I'm developing on Vista for target XP clients on a windows server 2003 system.  The network copy of the application is classed as the 'live' master and I'm after updating their local copy if it is out of date.  Users will run this pre loader and if the version is OK will launch the application, otherwise it will copy the latest version and then launch it<br/>Sun, 22 Nov 2009 08:49:31 Z2009-11-23T08:15:32Z