excel-vba

why does Msxml DocumentElement/SelectSingleNode returns nothing?

房东的猫 提交于 2020-01-05 03:27:33
问题 The DocumentElement property and the SelectSingleNode keep on returning nothing, I have verified that the xml loads correctly, the problem seems to lie in the xml parser. The xml does not have any namespaces so it shouldn't needed to be set. Private Function ParseWord(word As String) As String Dim tempFile As String tempFile = Environ("temp") & "\" & "temporaryWord" & ".xml" Call CreateFile(tempFile, word) Dim xmlDoc As Object Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0") With xmlDoc

why does Msxml DocumentElement/SelectSingleNode returns nothing?

和自甴很熟 提交于 2020-01-05 03:27:29
问题 The DocumentElement property and the SelectSingleNode keep on returning nothing, I have verified that the xml loads correctly, the problem seems to lie in the xml parser. The xml does not have any namespaces so it shouldn't needed to be set. Private Function ParseWord(word As String) As String Dim tempFile As String tempFile = Environ("temp") & "\" & "temporaryWord" & ".xml" Call CreateFile(tempFile, word) Dim xmlDoc As Object Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0") With xmlDoc

VBA Exclude special characters and numbers but keep spaces from string

风流意气都作罢 提交于 2020-01-05 03:15:19
问题 I have the text "abcd 24 ef-gh" in an excel cell. I need to get rid of "24" and "-" but keep all letters and spaces. I have a function that loops through the text and identifies letters using the like operator. For some reason, it doesn't exclude the "24" nor the "-" for which I added a replace statement before the loop: Function StripNonAlpha(TextToReplace As String) As String Dim i As Integer Dim a, b, c As String a = Replace(TextToReplace, "-", " ") For i = 1 To Len(a) b = Mid(a, i, 1) If

Outlook to Excel hyperlink issue

坚强是说给别人听的谎言 提交于 2020-01-05 02:58:55
问题 Hoping you can help me understand what i am doing wrong here. As part of my Outlook macro, i am looking to update a cell in excel with a hyperlink to a document. '~~> Excel variables Dim oXLApp As Object, oXLwb As Object, oXLws As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~

Copy Access database query into Excel spreadsheet

六眼飞鱼酱① 提交于 2020-01-05 02:53:11
问题 I have an Access database and an Excel workbook. What I need to do is query the database and paste the query into a worksheet. The issue is Runtime. I have stepped throught the program and everything works, but it works extremely slow, we're talking up to 30 second run times per query, although most of this run time is coming with the CopyFromRecordset call. The database has over 800k rows in the table I'm querying. Currently at my company there are people every morning who manually query the

Excel VBA Copy and Paste (without using Copy+Paste functions) on empty row

巧了我就是萌 提交于 2020-01-05 02:31:06
问题 I've done this before and I'm scratching my head to why I can't figure it out. I'm trying to pull data from one sheet and paste it into another sheet on the next row. I've done this before without using "copy" or "paste" VBA functions.. I just used values and I would like to make it easier on the user that way (no random copied things on the excel clipboard) Here is my code: Sub SubmitChange() row_number = 2 Do DoEvents Row_number = row_number + 1 item_in_review = Sheet44.Range("B" & row

run time error 5 in VBA excel when working with array

六眼飞鱼酱① 提交于 2020-01-05 02:11:36
问题 I use vba on excel 2007, OS: windows vista, to make calculation using kinematic wave equation in finite difference scheme. But, when it runs the run-time 5 (invalid procedure call or arguments) message appears. I really don't what is going wrong. Anyone can help? Sub kwave() Dim u(500, 500), yy(500, 500), alpha, dt, dx, m, n, so, r, f, X, L, K As Single Dim i, j As Integer dx = 0.1 dt = 0.01 L = 10 m = 5 / 3 r = 1 f = 0.5 n = 0.025 so = 0.1 'this is slope alpha = 1 / n * so ^ 0.5 X = 0 For i

run time error 5 in VBA excel when working with array

筅森魡賤 提交于 2020-01-05 02:10:33
问题 I use vba on excel 2007, OS: windows vista, to make calculation using kinematic wave equation in finite difference scheme. But, when it runs the run-time 5 (invalid procedure call or arguments) message appears. I really don't what is going wrong. Anyone can help? Sub kwave() Dim u(500, 500), yy(500, 500), alpha, dt, dx, m, n, so, r, f, X, L, K As Single Dim i, j As Integer dx = 0.1 dt = 0.01 L = 10 m = 5 / 3 r = 1 f = 0.5 n = 0.025 so = 0.1 'this is slope alpha = 1 / n * so ^ 0.5 X = 0 For i

Runtime Error '1004':, Method 'Intersect' of object '_Global' failed

末鹿安然 提交于 2020-01-04 23:30:28
问题 I am getting a runtime error 1004 if I'm not on the same page that the script is meant to run on, and I'd like to know why... here is the code. Option Explicit Sub PO_Tracking() Dim wsPOD As Worksheet Dim wsPOT As Worksheet Dim wsPOA As Worksheet Dim cel As Range Dim lastrow As Long, i As Long, Er As Long Set wsPOD = Sheets("PO Data") Set wsPOT = Sheets("PO Tracking") Set wsPOA = Sheets("PO Archive") With Application .ScreenUpdating = False .DisplayAlerts = False .EnableEvents = False

VBA Borders Excel Dependent on Page Size

こ雲淡風輕ζ 提交于 2020-01-04 19:17:28
问题 I want to create borders around each of my excel pages dependent on the size of the page e.g. number of rows and columns can vary all the time. I've tried this but it's specific cells Sub AddBorders() With Range("B8:I10") .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders(xlEdgeTop).LineStyle = xlContinuous End With End Sub 回答1: UsedRange should NEVER be used to find the last cell which has data