excel-vba

Is it possible to batch convert csv to xls using a macro?

旧巷老猫 提交于 2020-01-13 05:13:28
问题 I have a large amount of csv files that I need in .xls format. Is it possible to run a batch conversion with a macro or best done with another language? I have used this code http://www.ozgrid.com/forum/showthread.php?t=71409&p=369573#post369573 to reference my directory but I'm not sure of the command to open each file and save them. Here's what I have: Sub batchconvertcsvxls() Dim wb As Workbook Dim CSVCount As Integer Dim myVar As String myVar = FileList("C:\Documents and Settings

Excel 2007 VBA Problem setting Axis Title

让人想犯罪 __ 提交于 2020-01-13 05:01:27
问题 I need help setting the X and Y axes title inside Excel 2007 VBA. It keeps complaining about "Object required": Sub macro2() Dim xAxis As Axis icount = 1 Charts.Add Charts(icount).Name = iskewplane & "deg Skew Plane" Charts(icount).Activate Set xAxis = Charts(icount).Axes(xlCategory) With xAxis .Axis .AxisTitle.Text = "Theta (deg)" End With Is there something wrong in my code? I tried recording the macro during setting the axis title name, but the macro is blank during the name setting. Any

Posting huge datasets to a webservice from excel VBA

时光毁灭记忆、已成空白 提交于 2020-01-12 17:40:54
问题 Hello fellow Excel vba coders I have this great macro in my excel sheet, where i compile XML based on the rows the user puts in - after this it post the xml to a webservice. You can have a look at my code below - It is fairly simple: Set XMLHttpRequest = New MSXML2.XMLHTTP With XMLHttpRequest .Open "POST", URL, False .setRequestHeader "Content-Type", "text/xml; encoding='utf-8'" .setRequestHeader "Content-Length", strLength .send strXML End With Right now it works great when there is less

Forcing Garbage Collection

匆匆过客 提交于 2020-01-12 16:09:53
问题 Is there a way to force garbage collection in VBA/Excel 2000? This question refers to the Macro language in Excel. Not using VB .NET to manipulate Excel. So GC.collect() won't work 回答1: You cannot take advantage of garbage collection provided by the .NET Framework when using straight VBA. Perhaps this article by Eric Lippert will be helpful 回答2: You can't force GC in VBA, but it's good to set to Nothing the global variables. The article mentioned by kd7 says it's useless to set to Nothing the

Forcing Garbage Collection

我怕爱的太早我们不能终老 提交于 2020-01-12 16:08:11
问题 Is there a way to force garbage collection in VBA/Excel 2000? This question refers to the Macro language in Excel. Not using VB .NET to manipulate Excel. So GC.collect() won't work 回答1: You cannot take advantage of garbage collection provided by the .NET Framework when using straight VBA. Perhaps this article by Eric Lippert will be helpful 回答2: You can't force GC in VBA, but it's good to set to Nothing the global variables. The article mentioned by kd7 says it's useless to set to Nothing the

VbComponents.Remove doesn't always remove module

馋奶兔 提交于 2020-01-12 14:33:35
问题 I'm trying to use Chip Pearson's code for overwriting an existing VBA code module with an import from another project. Original code here. The particular section I'm looking at is: With ToVBProject.VBComponents .Remove .Item(ModuleName) End With But this VBComponents.Remove call will sometimes only actually take effect once VBA execution has stopped--that is, the delete operation doesn't take effect until all statements are finished, or if the code hits a breakpoint and then I stop debugging.

VbComponents.Remove doesn't always remove module

岁酱吖の 提交于 2020-01-12 14:31:32
问题 I'm trying to use Chip Pearson's code for overwriting an existing VBA code module with an import from another project. Original code here. The particular section I'm looking at is: With ToVBProject.VBComponents .Remove .Item(ModuleName) End With But this VBComponents.Remove call will sometimes only actually take effect once VBA execution has stopped--that is, the delete operation doesn't take effect until all statements are finished, or if the code hits a breakpoint and then I stop debugging.

VBA, if a string contains a certain letter

不想你离开。 提交于 2020-01-12 03:32:22
问题 I do not usually work with VBA and I cannot figure this out. I am trying to determine whether a certain letter is contained within a string on my spreadhseet. Private Sub CommandButton1_Click() Dim myString As String RowCount = WorksheetFunction.CountA(Range("A:A")) MsgBox RowCount For i = 2 To RowCount myString = Trim(Cells(i, 1).Value) If myString.Contains("A") Then oldStr = Cells(i, 15).Value newStr = Left(oldStr, oldStr.IndexOf("A")) End If Next End Sub This code should go through a list

Status Bar Progress Meter not showing messages

大兔子大兔子 提交于 2020-01-11 14:24:28
问题 I'm trying to put together a 'Status Bar Progress Meter' to help the user when loading a lengthy macro. I've carried out some research and found this to be the type that I'd like to use. The problem I have is that the progress bar doesn't move across the Status Bar and the first and last messages i.e. "Working" and "All Files Extracted" are not shown. Where have I gone wrong? Private Sub btnFetchFiles_Click() Dim j As Integer iRow = 20 fPath = "\\c\s\CAF1\Dragon Mentor Group\Dragon Scripts

Status Bar Progress Meter not showing messages

隐身守侯 提交于 2020-01-11 14:24:06
问题 I'm trying to put together a 'Status Bar Progress Meter' to help the user when loading a lengthy macro. I've carried out some research and found this to be the type that I'd like to use. The problem I have is that the progress bar doesn't move across the Status Bar and the first and last messages i.e. "Working" and "All Files Extracted" are not shown. Where have I gone wrong? Private Sub btnFetchFiles_Click() Dim j As Integer iRow = 20 fPath = "\\c\s\CAF1\Dragon Mentor Group\Dragon Scripts