excel-vba

Get Workbook Connection Names [closed]

余生颓废 提交于 2020-01-15 05:31:05
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . I would like to know how to get the list of the workbook connection names in Excel using VBA. 回答1: This will print all of the connection names to the debug window. Dim conn As WorkbookConnection For Each conn In

Get Workbook Connection Names [closed]

不羁岁月 提交于 2020-01-15 05:31:01
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . I would like to know how to get the list of the workbook connection names in Excel using VBA. 回答1: This will print all of the connection names to the debug window. Dim conn As WorkbookConnection For Each conn In

Lock Cells after Data Entry

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-15 05:24:08
问题 I have a spreadsheet that is edited by multiple users. To prevent tampering with previous data the cells are locked once data has been entered and the file saved. I have a few small bugs in the code though: Even if the user has saved manually and then exits the application they are still prompted to save again. The cells should be locked after a save when the application is running and not just when it is exited. Previously I had this code in the before_save event but the cells were being

Excel VBA CDO Mail

↘锁芯ラ 提交于 2020-01-15 05:04:44
问题 I'm trying to send a mail with Microsoft Office Excel 2007 VBA code but I'm getting the error: Run-time error '-2147220973 (80040213)': Automation error The code that I'm using is: Dim cdomsg As Object Set cdomsg = CreateObject("CDO.message") With cdomsg.Configuration.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp

Excel VBA CDO Mail

て烟熏妆下的殇ゞ 提交于 2020-01-15 05:03:45
问题 I'm trying to send a mail with Microsoft Office Excel 2007 VBA code but I'm getting the error: Run-time error '-2147220973 (80040213)': Automation error The code that I'm using is: Dim cdomsg As Object Set cdomsg = CreateObject("CDO.message") With cdomsg.Configuration.Fields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 25 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp

Excel VBA: Run-time error (Method 'Value' of object 'Range' failed), but only on consecutive runs

孤街醉人 提交于 2020-01-15 04:20:41
问题 I'm having an issue with a VBA project I'm working on at the moment, specifically a run-time error with a piece of code that finds the next empty cell at the bottom of the table and writes stored strings to that range Now - a quick explanation of the project. I've a table in an Excel sheet that records each prospective job that the company I work for may have coming-up. To that I have a front-end that has controls for creating/reviewing new "Jobs" or "Opportunities", and the code that runs

Excel VBA: Run-time error (Method 'Value' of object 'Range' failed), but only on consecutive runs

拟墨画扇 提交于 2020-01-15 04:19:05
问题 I'm having an issue with a VBA project I'm working on at the moment, specifically a run-time error with a piece of code that finds the next empty cell at the bottom of the table and writes stored strings to that range Now - a quick explanation of the project. I've a table in an Excel sheet that records each prospective job that the company I work for may have coming-up. To that I have a front-end that has controls for creating/reviewing new "Jobs" or "Opportunities", and the code that runs

Export excel file to txt format via excel vba GUI

烂漫一生 提交于 2020-01-15 03:40:14
问题 My goal is to export excel file to txt file format. The idea is to has a GUI to let user select the excel file that she/he wish to export and she/he can decide which file path and file name to save. Once users has finish input and output setting, he/she just need to click Export text button to export the excel file to txt file and save in the location that he/she has decided. The GUI as below I've a macro to convert excel file to txt format Private Sub ConvertToText() ActiveWorkbook.SaveAs

Stripping Column or Row to Make 1D Array

放肆的年华 提交于 2020-01-15 03:21:06
问题 I want to create a 1D array from a 2D array without looping using only 1 line of code such as: newvec = oldvec(:,3) which in MATLAB would create a 1D array "newvec" from the 3rd column of "oldvec". My searching tells me the only way to do this in VBA is looping. For example: redim newvec(ubound(oldvec,1)) for i = 1 to ubound(oldvec,1) newvec(i) = oldvec(i,3) next i Is there a built in construct for stripping our entire singular dimensions of an existing 2D array to build a new 1D array? 回答1:

VBA call same C++ dll return different results

笑着哭i 提交于 2020-01-15 02:39:05
问题 I have a test dll function that reads a string and display it: int _stdcall test(LPSTR myString) { MessageBoxA(NULL, (LPCSTR)myString, "test", MB_OK); return 0;} The excel VBA declaration is Declare Function test Lib "test.dll" (ByVal text As String) As Long There is a sub that calls the function. It reads an excel cell with value as "abcde" and is able to display a correct result. The sub code is: sub testCode() test (cells(1,1).value) end sub However when call the dll function using excel