excel-vba

Read XML child node Attribute on VBA with oDOC

拥有回忆 提交于 2020-01-07 02:35:06
问题 I have a list of different animals (following XML file), some of the animals have children, I wrote something that print all children animal names it won't work it say "object dosen't support this property or method" If I would replace this line : Set list =oDoc.SelectSingleNode("/animal/cat[(@ID)=""17""]") to that one: Set list = xDoc.SelectNodes("/animal/cat[(@ID)=""17""]") my code works perfect , but I can't replace it because other method required that list will defined like that : Set

VBA Excel: Insert a new column every nth column filled with a formula which refrences the immediate column to the left

寵の児 提交于 2020-01-07 02:31:07
问题 I would like to insert a new column every other column about 260 times, then I need to fill the new columns with a formula which references the immediate column to the left. Here is what I have to insert a new column: Sub insert_column_every_other() For colx = 2 To 266 Step 2 Columns(colx).Insert Shift:=xlToRight Next End Sub But I am stuck on the formula, it merely copies the formula as is.. I need the C3 value to change and reference the immediate column to the left (other parts might not

Unable to Set the LineStyle Property of the Border Class?

China☆狼群 提交于 2020-01-07 02:25:34
问题 With Sheets(1).Range(Cells(row + 1, 1), Cells(row + 1, "V")) .Interior.ColorIndex = 48 ' .Borders (xlInsideHorizontal) .LineStyle = xlSlantDashDot .Weight = xlThin .ColorIndex = 15 .Font.Name = "Times New Roman" .Font.Size = 25 End With .LineStyle = xlSlantDashDot This is the line showing the error . Is it about the MS office version ? I m using MS officer 2010 version . Or this property is too old ,that I can 't use xlSlantDashDot . Any other excel cell thick linestyle suggested ? The error

Array prepared within a VBA event. How to extract its contents from inside a different event?

浪尽此生 提交于 2020-01-07 02:16:08
问题 This question should apply to any VBA situ with events: I've filled an array within a Form_Load() event in MS Access. Now I would like to extract, dereference, the contents of that array from within a ListBox_DblClick() event. I Dim'd the array at the top of the form module (if it was Excel, it would be a sheet module) they both share; no luck in having the ListBox_DblClick event recognize that there is an array anywhere. Thanks for any help: Dim ArrWhatever() As String Function ThisArr

Divide the cell content into separate rows along with corresponding columns

前提是你 提交于 2020-01-07 02:11:12
问题 I am trying to split the cell content with length greater than 72 into separate rows with their length not increasing more than 72 chars. But I was trying to do how can I repeat the serial number for each cell while dividing them into 72 chars. For example if I have a cell with 144 chars and serial number S1 assigned to it in another column, so when I use the above module to divide the text into 2 cells then the same Serial number S1 is also copied to each new cell created. Can we do it? Code

Import entire folder of Excel files into Access 2013

吃可爱长大的小学妹 提交于 2020-01-07 01:48:40
问题 I am having a super hard time trying to import multiple Excel files into a specific Access 2013 table. I tried using the code I found from another SO question: Do While Len(strFile) > 0 DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _ strTable, strPathFile, blnHasFieldNames Loop but this makes new tables for each file, and I need all 101 files to be in a single table. The code I try to test it fails on DoCmd.TransferSpreadsheet, and I can't seem to get that part to work at all.

Excel VBA + lookup with Dictionary

扶醉桌前 提交于 2020-01-07 01:16:26
问题 I am trying to do a lookup with dictionary. However, I am not able to extract the offset of the key. I've checked that my Dict has loaded all of the data that I want, including the necessary offset value. (the for next loop of the commented) My question now is, how do extract the offset value, when Dic.Exists(profitCentre) is found? Dim cl As Range, Dic As Object Set Dic = CreateObject("Scripting.Dictionary"): Dic.Comparemode = vbTextCompare With Workbooks(wbPropListing).Sheets("Residential")

Excel VBA + lookup with Dictionary

主宰稳场 提交于 2020-01-07 01:12:31
问题 I am trying to do a lookup with dictionary. However, I am not able to extract the offset of the key. I've checked that my Dict has loaded all of the data that I want, including the necessary offset value. (the for next loop of the commented) My question now is, how do extract the offset value, when Dic.Exists(profitCentre) is found? Dim cl As Range, Dic As Object Set Dic = CreateObject("Scripting.Dictionary"): Dic.Comparemode = vbTextCompare With Workbooks(wbPropListing).Sheets("Residential")

VBA: Formatting Multiple Selected Charts (Chart, Plot, Legend, etc.)

烈酒焚心 提交于 2020-01-06 23:51:27
问题 I am looking to format multiple selected charts on Excel 2010 using VBA. I want the code to work whether I choose one or multiple charts. The code below works when only one chart is selected but when multiple charts are selected, I get a "run-time error '91' Object variable or With Block variable not set". Any idea how to run the macro for number of selected charts? Sub ChartFormat5_Click() ''Adjust chart area ActiveChart.ChartArea.Select 'Size Selection.Width = 631.9 Selection.Height = 290.1

How can I disable printing an excel workbook EXCEPT when using a Print-to-PDF macro button?

跟風遠走 提交于 2020-01-06 23:47:19
问题 I searched the site and could not find an answer for this. Background: I have this Macro as a button on a worksheet. It works well for what I need: Sub FactSheetSaveToPDF() ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "C:\" & Range("b2") & " - " & Month(Date) & "." & Day(Date) & "." & Year(Date) & "." _ & Hour(Time) & Minute(Time) & Second(Time) & ".pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=True End Sub What I