Home > Software engineering >  Vba intercept string problem
Vba intercept string problem

Time:10-19

Address of a string: "C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX"

I want to use vba to intercept the last name "1234. XLSX
"
How should do? The previous address is uncertain, how to take

CodePudding user response:

"C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX" is a Variant type,

CodePudding user response:

Mid $(" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", instrrev (" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", "") + 1)

Make a suggestion, don't use the Variant in String has a hidden trouble,

CodePudding user response:

refer to the second floor ChoasRules response:
mid $(" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", instrrev (" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", "") + 1)

Make a suggestion, don't use the Variant in String has hidden dangers,

I don't think any type should use the Variant,

The String with the Variant, what is the hidden trouble?
I haven't heard of ah, is "digital" string is ambiguous? I think don't you.

CodePudding user response:

The
reference 3 floor Chen8013 response:
I don't think any type should use the Variant,

The String with the Variant, what is the hidden trouble?
I haven't heard of ah, is "digital" string is ambiguous? I think don't you.


Be consulted, of the following code change var1 in addition to using the Variant type, you can also use what type?
SheetName var1=Worksheets (" "). The Range (" A1, B2). Value2

CodePudding user response:

reference 4 floor subMain response:
Quote: refer to the third floor Chen8013 response:

I don't think any type should use the Variant,

The String with the Variant, what is the hidden trouble?
I haven't heard of ah, is "digital" string is ambiguous? I think don't you.


Be consulted, of the following code change var1 in addition to using the Variant type, you can also use what type?
SheetName var1=Worksheets (" "). The Range (" A1, B2). Value2


Separate said that the "value", but have no alternative...

But you may also know that there are many ways to achieve the same effect,
And, the "value" in addition to use in the Excel Sheet. The Range () assignment, I'm afraid no other use,
But, before that also said, to accomplish this, and other a variety of specific types of operation method,

CodePudding user response:

reference Chen8013 reply: 3/f
Quote: refer to the second floor ChoasRules response:

Mid $(" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", instrrev (" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", "") + 1)

Make a suggestion, don't use the Variant in String has hidden dangers,

I don't think any type should use the Variant,

The String with the Variant, what is the hidden trouble?
I haven't heard of ah, is "digital" string is ambiguous? I think don't you.



Oh, this problem, I'm not single string type, if can clear all should not use the variant type, there are several reasons, such as code readability is poor,

And there is Currency in the Variant variables, a Double value exceeds the scope of their respective, mistakes will happen, I just remind the building Lord, try not to use,

Don't know what will appear problem, remind,

CodePudding user response:

refer to 6th floor ChoasRules response:
Quote: refer to the third floor Chen8013 response:

Quote: refer to the second floor ChoasRules response:

Mid $(" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", instrrev (" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", "") + 1)

Make a suggestion, don't use the Variant in String has hidden dangers,

I don't think any type should use the Variant,

The String with the Variant, what is the hidden trouble?
I haven't heard of ah, is "digital" string is ambiguous? I think don't you.



Oh, this problem, I'm not single string type, if can clear all should not use the variant type, there are several reasons, such as code readability is poor,

And there is Currency in the Variant variables, a Double value exceeds the scope of their respective, mistakes will happen, I just remind the building Lord, try not to use,

Don't know what will appear problem, remind,

This "the Variant type", it seems that only some VB,
I know several other common computer language, don't like "the Variant types" (or similar to the Variant data type),
I write VB/VBA code, will never use the Variant type,

CodePudding user response:

refer to 7th floor Chen8013 response:
Quote: refer to the sixth floor ChoasRules response:

Quote: refer to the third floor Chen8013 response:

Quote: refer to the second floor ChoasRules response:

Mid $(" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", instrrev (" C: \ Documents and Settings \ Administrator \ デ ス ク ト ッ プ \ 1234. XLSX ", "") + 1)

Make a suggestion, don't use the Variant in String has hidden dangers,

I don't think any type should use the Variant,

The String with the Variant, what is the hidden trouble?
I haven't heard of ah, is "digital" string is ambiguous? I think don't you.



Oh, this problem, I'm not single string type, if can clear all should not use the variant type, there are several reasons, such as code readability is poor,

And there is Currency in the Variant variables, a Double value exceeds the scope of their respective, mistakes will happen, I just remind the building Lord, try not to use,

nullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related